SwiftPointSeriesView Class
A series view that allows you to quickly render a large number of scatter points.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.1.dll
NuGet Package: DevExpress.Charts
Declaration
[TypeConverter(typeof(SwiftPointSeriesViewTypeConverter))]
public class SwiftPointSeriesView :
SwiftPlotSeriesViewBase,
IPointSeriesView
Remarks
The SwiftPointSeriesView
is a lightweight analog of the PointSeriesView and is plotted on the SwiftPlotDiagram. The SwiftPointSeriesView
supports a limited list of features in comparison with the PointSeriesView
. This limitation allows the SwiftPointSeriesView
to render points faster, and helps save CPU and RAM resources. For the list of limitations, refer to the following section: View Limitations.
Main Characteristics
The table below lists the main characteristics of the Swift Point chart type.
Feature | Value |
---|---|
Diagram type | SwiftPlotDiagram |
Number of arguments per series point | 1 |
Number of values per series point | 1 |
Specific View Options
The SwiftPointSeriesView
class introduces the PointMarkerOptions property that allows you to access marker settings such as marker size, kind, fill style, and so on.
Create a Swift Point Chart
This example shows how to create a Swift Point chart and configure its axes, legend, and appearance at runtime.
Follow the steps below to create a sample Swift Point chart:
- Add a chart to the project.
- Create a series and add it to the chart.
- Call the Series.BindToData method to bind the series to a data source, and define data members that contain arguments and values.
- Use the SwiftPointSeriesView.PointMarkerOptions property to access series view marker settings, and configure the marker size and type.
- Enable scrolling and zooming capabilities for x- and y-axes.
- Specify axis ranges to limit visible data.
- Define the legend position.
using DevExpress.XtraCharts;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace SwiftPointChart {
public partial class Form1 : Form {
const int PointsCount = 100000;
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
List<Point> data = GenerateData();
Series series = new Series("Random Data", ViewType.SwiftPoint);
chartControl1.Series.Add(series);
series.BindToData(data, "X", "Y");
SwiftPointSeriesView view = (SwiftPointSeriesView)series.View;
view.Color = Color.FromArgb(180, chartControl1.GetPaletteEntries(1)[0].Color);
view.PointMarkerOptions.Size = 6;
view.PointMarkerOptions.Kind = MarkerKind.Square;
SwiftPlotDiagram diagram = (SwiftPlotDiagram)chartControl1.Diagram;
diagram.EnableAxisXScrolling = true;
diagram.EnableAxisXZooming = true;
diagram.EnableAxisYScrolling = true;
diagram.EnableAxisYZooming = true;
diagram.DependentAxesYRange = DevExpress.Utils.DefaultBoolean.True;
diagram.AxisX.VisualRange.SetMinMaxValues(3460, 3680);
diagram.AxisY.VisualRange.SetMinMaxValues(400000, 1600000);
chartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.TopOutside;
}
List<Point> GenerateData() {
List<Point> data = new List<Point>(PointsCount);
Random random = new Random(0);
double value;
int square, price, maxValue, minValue;
for (int i = 0; i < PointsCount; i++) {
value = random.NextDouble();
value = (Math.Pow(value, 15) + 1.2) * Math.Pow(value, 0.2) / 2.2;
maxValue = random.Next(10) == 1 ? (int)(random.NextDouble() * 2000 + 4000) : random.Next(1000) + 4500;
minValue = random.Next(11) == 10 ? 400 : 600;
square = (int)(value * maxValue + minValue);
if (random.Next(800 - square / 10) == 1)
maxValue = (int)(3000000 * (random.NextDouble() + 1));
else
maxValue = 3 * (int)((Math.Pow(value, 2) + 0.5) * Math.Pow(value, 0.2) * 670000);
value = random.NextDouble();
minValue = random.Next(11) == 10 ? 400000 : 200000;
price = (int)(value * maxValue + minValue);
if (price > 2000000 * (0.2 * random.NextDouble() + 1) && square < random.Next(1000) + 3500)
square += random.Next(2000);
if (price > 3000000 * (0.2 * random.NextDouble() + 1))
square += random.Next(2000);
data.Add(new Point(square, price));
}
return data;
}
}
}
View Limitations
The following features are not available for the SwiftPointSeriesView
:
- Tooltips
- Series point labels
- Scale breaks
- Diagram rotation
- Reversed axes
- Runtime series hit-testing
- Selection and highlighting
- The ChartControl.CustomDrawSeriesPoint event