Chart for .NET / User's Guide / Chart Types / XY Scatter Series Functionality

In This Topic
    XY Scatter Series Functionality
    In This Topic
    The NXYScatterSeries class is the base class of all series that provide XY scatter functionality. It is derived from the NSeries class and extends its capabilities with the following features:
     X Values Data Series
    The XValues data series contains double values that determine the positions of the data points along the X axis. This data series is accessible through the XValues property of the NXYScatterSeries object.
     Control over the usage of the X Values

    The UseXValues property of the NXYScatterSeries object controls whether the series will use the custom X positions or use the default ones (equal to the data point index e.g. 0, 1, 2 ... n). By default this property is set to false. The following code will enable the custom X positions of the data points:

    C#
    Copy Code
    series.UseXValues = true;
    
    Visual Basic
    Copy Code
    series.UseXValues = True
    
     Formatting Commands

    The NXYScatterSeries class extends the formatting commands set inherited from the NSeries base class with the following formatting commands:

    <xvalue> - the current data point X value (extracted from the XValues data series)

     Notes on scaling

    The X values affect the scale of the X axis. By default all series are scaled on the PrimaryX axis, which operates in Ordinal scale mode. If you display XY scatter charts it is recommended that you change the scaling mode to Numeric, DateTime or Logarithmic. The following code demonstrates how to do this:

    C#
    Copy Code
    NChart chart = chartControl.Charts[0];
    chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();
    
    NPointSeries series = (NPointSeries)chart.Series.Add(SeriesType.Point);
    series.UseXValues = true;
    series.Values.Add(10);
    series.Values.Add(16);
    series.Values.Add(14);
    series.XValues.Add(50);
    series.XValues.Add(70);
    series.XValues.Add(80);
    
    Visual Basic
    Copy Code
    Dim chart As NChart = chartControl.Charts(0)
    chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = New NLinearScaleConfigurator
    Dim series As NPointSeries = chart.Series.Add(SeriesType.Point)
    series.UseXValues = True
    series.Values.Add(10)
    series.Values.Add(16)
    series.Values.Add(14)
    series.XValues.Add(50)
    series.XValues.Add(70)
    series.XValues.Add(80)
    

    Please refer to the Axis scaling topic for more information.

     

    See Also