Xceed Chart for WinForms v4.4 Documentation
Welcome to Xceed Chart for WinForms v4.4 / User Guide / Series / XY Scatter Series Functionality

In This Topic
    XY Scatter Series Functionality
    In This Topic

    The XYScatterSeries class is the base class of all series that require XY scatter functionality. It is derived from Series and inherits all its functionality. The class extends this functionality with the features described below.

    XValues Data Series

    A data series containing double values. It is accessible through the XValues property of the XYScatterSeries object. This data series contains the custom X positions of the series data points.

    Control over Using XValues

    The UseXValues property of the XYScatterSeries object controls whether the series will use custom X positions or use 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:

    VB.NET  
    series.UseXValues = True
    C#  
    series.UseXValues = true;

    XYScatterSeries Formatting Commands

    The XYScatterSeries class extends the formatting command-set inherited from the Series base class with the following formatting commands:

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

    Helper Methods for Inserting Values into the XYScatterSeries Data Series

    Helper methods are available for inserting the following information into the respective data series:

    value, xvalue
    value, xvalue, label
    value, xvalue, label, fill effect
    value, xvalue, label, fill effect, line properties

    The following examples demonstrate the four overrides of the AddXY method. 

    1. Add only values and xvalues.

    VB.NET  

    series.AddXY(10, 2)

    series.AddXY(20, 4)

    series.AddXY(15, 5)

    C#  
    series.AddXY(10, 2);
    series.AddXY(20, 4);
    series.AddXY(15, 5);

    2. Add values, xvalues, and labels, and display the labels in the data labels and legend.

    VB.NET  

    series.AddXY(10, 20, "Apples")

    series.AddXY(20, 12, "Oranges")

    series.AddXY(15, 28, "Bananas")

    series.DataLabels.Format = "<value> <label>"

    series.Legend.Mode = SeriesLegendMode.DataPoints

    series.Legend.Format = "<value> <label>"

    C#  
    series.AddXY(10, 20, "Apples");
    series.AddXY(20, 12, "Oranges");
    series.AddXY(15, 28, "Bananas");
    series.DataLabels.Format = "<value> <label>";
    series.Legend.Mode = SeriesLegendMode.DataPoints;
    series.Legend.Format = "<value> <label>";

    3. Add values, xvalues, labels, and fill effects, and display the data points in the specified colors

    VB.NET  

    series.AddXY(23, 45, "Item1", New FillEffect(Color.Chocolate))

    series.AddXY(67, 89, "Item2", New FillEffect(Color.Blue))

    series.AddXY(78, 12, "Item3", New FillEffect(Color.Coral))

    series.Appearance.FillMode = AppearanceFillMode.DataPoints

    C#  
    series.AddXY(23, 45, "Item1", new FillEffect(Color.Chocolate));
    series.AddXY(67, 89, "Item2", new FillEffect(Color.Blue));
    series.AddXY(78, 12, "Item3", new FillEffect(Color.Coral));
    series.Appearance.FillMode = AppearanceFillMode.DataPoints;

    4. Add values, xvalues, labels, fill effects, and line properties, and display the data points with the specified fill colors and line properties

    VB.NET  

    series.AddXY(23, 34, "Item1", New FillEffect(Color.Chocolate), New LineProperties(1, Color.Black))

    series.AddXY(67, 56, "Item2", New FillEffect(Color.Blue), New LineProperties(1, Color.Green))

    series.AddXY(78, 78, "Item3", New FillEffect(Color.Coral), New LineProperties(1, Color.Red))

     

    series.Appearance.FillMode = AppearanceFillMode.DataPoints

    series.Appearance.LineMode = AppearanceLineMode.DataPoints

    C#  
    series.AddXY(23, 34, "Item1", new FillEffect(Color.Chocolate), new LineProperties(1, Color.Black));
    series.AddXY(67, 56, "Item2", new FillEffect(Color.Blue), new LineProperties(1, Color.Green));
    series.AddXY(78, 78, "Item3", new FillEffect(Color.Coral), new LineProperties(1, Color.Red));
    series.Appearance.FillMode = AppearanceFillMode.DataPoints;
    series.Appearance.LineMode = AppearanceLineMode.DataPoints;

    Notes on Scaling XYScatterSeries

    Because the X position data values are scaled on the specified X axis (by default the PrimaryX axis), which by default operates in Dimensions mode, users must manually change this scaling mode to one of the value scaling modes (Numeric, DateTime or Logarithmic) if they intend to use the XValues. The following code will correctly display a XY scatter series.

    VB.NET  

    series.UseXValue = True

    Chart.Axis(StandardAxis.PrimaryX).ScaleMode = AxisScaleMode.Numeric

    C#  
    series.UseXValue = true;
    Chart.Axis(StandardAxis.PrimaryX).ScaleMode = AxisScaleMode.Numeric;

    Please refer to the Axis Scales topic for more information. 

    See Also

    XYScatterSeries