The series Z order in 2D mode is controlled by the position of the series inside the series collection. Series with lower index in the collection appear on top of series with higher index. You can also control the Z order using the Z order property - for example:
C# |
Copy Code
|
---|---|
NChart chart = nChartControl1.Charts[0]; NBarSeries bar = new NBarSeries(); NLineSeries line = new NLineSeries(); |
Visual Basic |
Copy Code
|
---|---|
Dim chart As NChart = NChartControl1.Charts(0) Dim bar As New NBarSeries bar.ZOrder = 0 bar.Values.Add(10) bar.Values.Add(20) bar.Values.Add(30) Chart.Series.Add(bar) Dim line As New NLineSeries line.ZOrder = 1 line.Values.Add(10) line.Values.Add(20) line.Values.Add(30) Chart.Series.Add(line) |
The above code will display the line on top of the bar even though it appears after the bar series in the collection.
You can scale the series on the standard and custom X and Y axes. The series is always scaled on the depth axis. The series scaling functionality is exposed through the following methods:
DisplayOnAxis - controls whether the series is scaled on a particular axis.
IsDisplayedOnAxis - queries whether the series is scaled on the specified axis.
For example a bar chart can be scaled on the secondary vertical axis with the following code:
C# |
Copy Code
|
---|---|
bar.DisplayOnAxis(StandardAxis.SecondaryY, true);
|
Visual Basic |
Copy Code
|
---|---|
bar.DisplayOnAxis(StandardAxis.SecondaryY, True)
|
You can remove the same bar from scaling on the PrimaryY axis with the following code:
C# |
Copy Code
|
---|---|
bar.DisplayOnAxis(StandardAxis.PrimaryY, false);
|
Visual Basic |
Copy Code
|
---|---|
bar.DisplayOnAxis(StandardAxis.PrimaryY, False)
|
Most of the general data manipulation routines (Sorting, Importing etc.) operate on a number of logically connected data series contained in a NDataSeriesCollection. You can easily create a collection of these data series with just one function call. This is achieved with help of the GetDataSeries virtual method defined in the NSeriesBase class. You can specify which series should be included and which series should be explicitly excluded. The last argument - ForceAlign - determines whether the data series sizes must be aligned to the largest size.
For example suppose that you want to obtain a data series collection containing the open, high, low and close data series that a stock chart uses. You can do that in two ways:
1. Explicitly specify which series must be contained in the collection:
C# |
Copy Code
|
---|---|
NDataSeriesCollection arrDataSeries;
arrDataSeries = stock.GetDataSeries(
DataSeriesMask.StockOpenValues |
DataSeriesMask.StockHighValues |
DataSeriesMask.StockLowValues |
DataSeriesMask.StockCloseValues, DataSeriesMask.None, false);
|
Visual Basic |
Copy Code
|
---|---|
arrDataSeries = stock.GetDataSeries( _ DataSeriesMask.StockOpenValues Or _ DataSeriesMask.StockHighValues Or _ DataSeriesMask.StockLowValues Or _ DataSeriesMask.StockCloseValues, DataSeriesMask.None, False) |
2. Include all data series by default, but explicitly exclude all other except the Open, High, Low and Close data series:
C# |
Copy Code
|
---|---|
NDataSeriesCollection arrDataSeries;
arrDataSeries = stock.GetDataSeries(DataSeriesMask.All,
DataSeriesMask.FillStyles |
DataSeriesMask.StrokeStyles |
DataSeriesMask.MarkerStyles |
DataSeriesMask.DataLabelStyles |
DataSeriesMask.InteractivityStyles |
DataSeriesMask.Tags |
DataSeriesMask.Labels |
DataSeriesMask.XValues, false);
|
Visual Basic |
Copy Code
|
---|---|
Dim arrDataSeries As NDataSeriesCollection arrDataSeries = stock.GetDataSeries(DataSeriesMask.All, _ DataSeriesMask.FillStyles Or _ DataSeriesMask.StrokeStyles Or _ DataSeriesMask.MarkerStyles Or _ DataSeriesMask.DataLabelStyles Or _ DataSeriesMask.InteractivityStyles Or _ DataSeriesMask.Tags Or _ DataSeriesMask.Labels Or _ DataSeriesMask.XValues, False) |
By default all series regard axis clipping. Axis clipping occurs when you specify an explicit axis view range in which case content of the series which falls outside the axis view range is clipped (not displayed). In some cases you may want to have series that are not clipped which is achieved by settings the RegardAxisClipping property to false:
C# |
Copy Code
|
---|---|
someSeries.RegardAxisClipping = false;
|
Visual Basic |
Copy Code
|
---|---|
someSeries.RegardAxisClipping = False
|
By default all series will automatically inflate the content ranges of the axes they scale on. You can alter this behaviour by setting the IncludeInXAxisRange, IncludeInYAxisRange, and IncludeInZAxisRange properties of the series. The following code tells the series not to affect the ranges of the X/Y/Z axes:
C# |
Copy Code
|
---|---|
someSeries.IncludeInXAxisRange = false; someSeries.IncludeInYAxisRange = false; someSeries.IncludeInZAxisRange = false; |
Visual Basic |
Copy Code
|
---|---|
someSeries.IncludeInXAxisRange = False someSeries.IncludeInYAxisRange = False someSeries.IncludeInZAxisRange = False |