Excel Charting - Align Secondary Axis with C#

The code for this is linked below, and the general algorithm used for aligning a chart's secondary axis with the primary axis:
  1. Get primary divisors
  2. Get upper and lower bounds of secondary
  3. Get larger ABS(max) or ABS(min)
  4. Multiply (max/min) divisor by numbers (1,2,5,10,20,25,30) to find the first multiplier larger than current
  5. Apply multiplier to major unit
  6. Apply min to min (min divisors x minor unit)
  7. Apply max to max (max divisors x major unit)


Click the download button for SecondaryAxisAlignment_C#.txt... Download Code