Back to Devexpress

SwiftPointSeriesView Class

corelibraries-devexpress-dot-xtracharts-c14d67e9.md

latest11.5 KB
Original Source

SwiftPointSeriesView Class

A series view that allows you to quickly render a large number of scatter points.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public class SwiftPointSeriesView :
    SwiftPlotSeriesViewBase,
    IPointSeriesView
vb
Public Class SwiftPointSeriesView
    Inherits SwiftPlotSeriesViewBase
    Implements 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.

FeatureValue
Diagram typeSwiftPlotDiagram
Number of arguments per series point1
Number of values per series point1

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:

csharp
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;
        }
    }
}
vb
Imports DevExpress.XtraCharts
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Windows.Forms

Namespace SwiftPointChart
    Public Partial Class Form1
        Inherits Form

        Const PointsCount As Integer = 100000

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
            Dim data As List(Of Point) = GenerateData()
            Dim series As Series = New Series("Random Data", ViewType.SwiftPoint)
            chartControl1.Series.Add(series)
            series.BindToData(data, "X", "Y")
            Dim view As SwiftPointSeriesView = CType(series.View, SwiftPointSeriesView)
            view.Color = Color.FromArgb(180, chartControl1.GetPaletteEntries(1)(0).Color)
            view.PointMarkerOptions.Size = 6
            view.PointMarkerOptions.Kind = MarkerKind.Square
            Dim diagram As SwiftPlotDiagram = CType(chartControl1.Diagram, SwiftPlotDiagram)
            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
        End Sub

        Private Function GenerateData() As List(Of Point)
            Dim data As List(Of Point) = New List(Of Point)(PointsCount)
            Dim random As Random = New Random(0)
            Dim value As Double
            Dim square, price, maxValue, minValue As Integer

            For i As Integer = 0 To PointsCount - 1
                value = random.NextDouble()
                value = (Math.Pow(value, 15) + 1.2) * Math.Pow(value, 0.2) / 2.2
                maxValue = If(random.Next(10) = 1, CInt((random.NextDouble() * 2000 + 4000)), random.Next(1000) + 4500)
                minValue = If(random.Next(11) = 10, 400, 600)
                square = CInt(value * maxValue + minValue)

                If random.Next(800 - square / 10) = 1 Then
                    maxValue = CInt((3000000 * (random.NextDouble() + 1)))
                Else
                    maxValue = 3 * CInt((Math.Pow(value, 2) + 0.5) * Math.Pow(value, 0.2) * 670000)
                End If

                value = random.NextDouble()
                minValue = If(random.Next(11) = 10, 400000, 200000)
                price = CInt(value * maxValue + minValue)
                If price > 2000000 * (0.2 * random.NextDouble() + 1) AndAlso square < random.Next(1000) + 3500 Then square += random.Next(2000)
                If price > 3000000 * (0.2 * random.NextDouble() + 1) Then square += random.Next(2000)
                data.Add(New Point(square, price))
            Next

            Return data
        End Function
    End Class
End Namespace

View Limitations

The following features are not available for the SwiftPointSeriesView:

Implements

IXtraSerializable

IXYSeriesView2D

IXtraSupportDeserializeCollectionItem

Inheritance

Object ChartElement SeriesViewBase XYDiagram2DSeriesViewBase SwiftPlotSeriesViewBase SwiftPointSeriesView

See Also

SwiftPointSeriesView Members

DevExpress.XtraCharts Namespace