Dependent Axis

The IsDependent allows to link the auxiliary axis with one from the main axes(AxisX or AxisY, depending on AxisType). The dependent axis always has the same minimum and maximum as the main axis.

New property DependentAxisConverter and delegate Axis.AxisConverter specifies function that is used to convert coordinate from main axis to the dependent axis.

The following code creates a depepdent Y-Axis:

c1Chart1.Reset(true);

 

        c1Chart1.Data.Children.Add(

          new DataSeries() { ValuesSource = new double[] { -10, 0, 10, 20, 30, 40 } });

        c1Chart1.ChartType = ChartType.LineSymbols;

 

        Axis axis = new Axis() { AxisType = AxisType.Y, IsDependent =true};

 

        // Celsius -> Fahrenheit

        axis.DependentAxisConverter = (val) => val * 9 / 5 + 32;

 

        c1Chart1.View.Axes.Add(axis);

 

The following image displays the dependent (leftmost) Y-Axis that shows values in Fahrenheits corresponding to the Celsius on the main Y-axis:

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.