Nevron .NET Vision
Chart for .NET / User's Guide / Chart Types / Basic Series Functionality

In This Topic
    Basic Series Functionality
    In This Topic
    All series types derive from the NSeriesBase class, which provides the following basic series functionality:
     Visibility control
    When a series is marked as hidden it is not displayed and does not affect the scale of the axes. The visibility is easily controlled with the help of the Visible property.
     Name of the series
    The name of the series can be displayed in the legend associated with the chart. Programmatically the name of the series can be modified with the help of the Name property.
     Z Order

    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:

    Copy Code

    NChart chart = nChartControl1.Charts[0];

    NBarSeries bar = new NBarSeries();
    bar.ZOrder = 0;

    NLineSeries line = new NLineSeries();
    line.ZOrder = 1;

    Visual Basic
    Copy Code
    Dim chart As NChart = NChartControl1.Charts(0)
    Dim bar As New NBarSeries
    bar.ZOrder = 0
    Dim line As New NLineSeries
    line.ZOrder = 1

    The above code will display the line on top of the bar even though it appears after the bar series in the collection.

     Margins control
    The series can be instructed to inflate its margins in order to fit in the chart area. This feature is very useful if you intend to display a chart, which is likely to be displayed partially outside of the charting area (bubble chart for example). Programmatically you can instruct the series to inflate its margins with the help of the InflateMargins property.
     Integration of the series in the chart legend
    Each series displayed by a particular chart can add some descriptive information about itself in a legend. This functionality is exposed by the NSeriesLegend object. This object is accessible through the Legend property. See the Legend Data  topic for more information.
     Series interactivity
    The default interactivity features of the series can be managed through the InteractivityStyle property. It exposes a NInteractivityStyle that controls the default tooltip, cursor and URL link for the series.
     Scaling of the series on one or more standard or custom X and Y axes

    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:

    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:

    Copy Code
    bar.DisplayOnAxis(StandardAxis.PrimaryY, false);
    Visual Basic
    Copy Code
    bar.DisplayOnAxis(StandardAxis.PrimaryY, False)
     Ability to selectively extract the data series contained by the series

    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:

    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:

    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)
    It is important to remember that internally the component checks whether the series, which will be present in the NDataSeriesCollection object are aligned when you try to export it to a DataTable. In this case you can either set the ForceAlign to true when you obtain the collection from the series or explicitly align the collection with the help of the Align method.
     Axis Clipping

    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:

    Copy Code
    someSeries.RegardAxisClipping = false;
    Visual Basic
    Copy Code
    someSeries.RegardAxisClipping = False
     Axis Range

    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:

    Copy Code
    someSeries.IncludeInXAxisRange = false;
    someSeries.IncludeInYAxisRange = false;
    someSeries.IncludeInZAxisRange = false;
    Visual Basic
    Copy Code
    someSeries.IncludeInXAxisRange = False
    someSeries.IncludeInYAxisRange = False
    someSeries.IncludeInZAxisRange = False
    See Also