Scatter Line Chart

  • 4 min to read

Short Description

The Scatter Line Chart is represented by the ScatterLineSeriesView object, which belongs to Point, Line and Spline Series Views. This view represents series points in the same order that they have in the collection. That is in contrast to other view types that sort their points by arguments, and some aggregate points with equal arguments into a single entry along the X-axis. A good example is the view type that is most similar in all other aspects - Line. Or, the Scatter Line Chart can be compared to the Point Chart, with the points connected by lines.

For example, the following image demonstrates a Scatter Line Chart, representing a graph for the Archimedian spiral.

ScatterLineChart_0

Chart Type Characteristics

The table below lists the main characteristics of this chart type.

Feature Value
Series View type ScatterLineSeriesView
Diagram type 2D-XYDiagram
Number of arguments per series point 1
Number of values per series point 1
Note

For information on which chart types can be combined with the Scatter Line Chart, refer to the Combining Different Series Views document.

Example

The following example demonstrates how to create a ChartControl with a series of the ScatterLineSeriesView type, and add this chart to a form at runtime. Note that for this particular scale type only, it's typical that series points aren't sorted by their arguments, but are instead displayed in the order in which they are added to the collection.

Before proceeding with this example, first create a Windows Forms Application in Visual Studio, and include all necessary assemblies to the References list of your project. Then, add the following code to the Form.Load event handler.

using DevExpress.XtraCharts;
// ...

private void Form1_Load(object sender, EventArgs e) {
    // Create a new chart.
    ChartControl scatterLineChart = new ChartControl();

    // Create a scatter line series.
    Series series1 = new Series("Series 1", ViewType.ScatterLine);

    // Add points to it.
    series1.Points.Add(new SeriesPoint(1, 2));
    series1.Points.Add(new SeriesPoint(2, 10));
    series1.Points.Add(new SeriesPoint(3, 4));
    series1.Points.Add(new SeriesPoint(4, 12));
    series1.Points.Add(new SeriesPoint(1.5, 17));
    series1.Points.Add(new SeriesPoint(2.5, 3));
    series1.Points.Add(new SeriesPoint(3.5, 14));
    series1.Points.Add(new SeriesPoint(2, 6));

    // Add the series to the chart.
    scatterLineChart.Series.Add(series1);

    // Set the numerical argument scale types for the series,
    // as it is qualitative, by default.
    series1.ArgumentScaleType = ScaleType.Numerical;

    // Access the view-type-specific options of the series.
    ((ScatterLineSeriesView)series1.View).LineStyle.DashStyle = DashStyle.Dash;

    // Access the type-specific options of the diagram.
    ((XYDiagram)scatterLineChart.Diagram).EnableAxisXZooming = true;

    // Hide the legend (if necessary).
    scatterLineChart.Legend.Visible = false;

    // Add a title to the chart (if necessary).
    scatterLineChart.Titles.Add(new ChartTitle());
    scatterLineChart.Titles[0].Text = "A Scatter Line Chart";

    // Add the chart to the form.
    scatterLineChart.Dock = DockStyle.Fill;
    this.Controls.Add(scatterLineChart);
}
Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1472.

See Also