In This Topic
Each axis in the component has several ranges that you can obtain at runtime if you wish to query different stages of the axis calculation process. Following is a description of the different axis ranges:
Series Range
This is the range of the series that scale on a particular axis. For example suppose you have a line series that scales on the PrimaryY axis and that the values of the line data points are 9, 15, 24. In this case the axis will have a series range of [9, 24]. You can specify for each series that it can compute an axis range, which includes only the currently visible data points. This is done with the VerticalAxisRangeMode property taking values from the AxisRangeMode enum:
AxisRangeMode |
Description |
Content |
The whole content of the series is included in the min/max calculation, regardless of the currently visible x axis range |
ViewRange |
Only the visible range of the series is included in the min/max calculation. |
The following line of code shows how to enable dynamic view range:
C# |
Copy Code
|
series.VerticalAxisRangeMode = AxisRangeMode.ViewRange;
|
Visual Basic |
Copy Code
|
series.VerticalAxisRangeMode = AxisRangeMode.ViewRange
|
This feature is most commonly used in conjunction with zooming and scrolling of the x axis.
Content Range
The axis content range is the series range inflated with the range inflators defined by the scale. At this stage certain rounding of the range may appear – for example when you have "round to tick" enabled and the step for the major ticks is 5 the series range above will be transformed to [5, 25]. The content range always encompasses the series range.
C# |
Copy Code
|
NChart chart = nChartControl1.Charts[0];
NAxis axis = chart.Axis(StandardAxis.PrimaryY);
axis.View = new NRangeAxisView(new NRange1DD(0, 200));
|
Visual Basic |
Copy Code
|
Dim chart As NChart = NChartControl1.Charts(0)
Dim axis As NAxis = chart.Axis(StandardAxis.PrimaryY)
axis.View = New NRangeAxisView(New NRange1DD(0, 200))
|
Now the axis will constantly display the [0, 200] range regardless of the values of the data that scales on it.
In case of date-time axis you have to convert the range begin/end values from DateTime to Double. You can do this with the help of the ToOADate function of the DateTime type:
C# |
Copy Code
|
double v1 = new DateTime(2009, 1, 1).ToOADate();
double v2 = new DateTime(2009, 1, 5).ToOADate();
axis.View = new NRangeAxisView(new NRange1DD(v1, v2));
|
Visual Basic |
Copy Code
|
Dim v1 As Double = New DateTime(2009, 1, 1).ToOADate()
Dim v2 As Double = New DateTime(2009, 1, 5).ToOADate()
axis.View = New NRangeAxisView(New NRange1DD(v1, v2))
|
View Range
This is the range of the axis after the axis view is applied. At this stage you can limit or totally modify the range displayed of the axis regardless of the values of the series or the applied range inflation. To modify the view range you need to assign a different axis view to the axis (by default it is NContentAxisView meaning that the content range and the view range will coincide). You can alter this by assigning a different view to the axis. The following code snippet will change the axis view to [0, 200]:
Page Range
After the View range is calculated the axis will calculate the page range if axis paging is enabled. There are two different types of axis paging – numeric and date time represented by the
NNumericAxisPagingView and
>NDateTimeAxisPagingView classes respectively, that derive from the base NAxisPagingView abstract class. By default the axis is configured to use numeric axis paging.
See Also