corelibraries-devexpress-dot-xtracharts-dot-swiftpointseriesview.md
Allows you to access Swift Point series marker settings.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
[PersistenceMode(PersistenceMode.InnerProperty)]
[XtraChartsLocalizableCategory(XtraChartsCategory.Appearance)]
public SimpleMarker PointMarkerOptions { get; }
<PersistenceMode(PersistenceMode.InnerProperty)>
<XtraChartsLocalizableCategory(XtraChartsCategory.Appearance)>
Public ReadOnly Property PointMarkerOptions As SimpleMarker
| Type | Description |
|---|---|
| SimpleMarker |
Contains marker options.
|
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:
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;
}
}
}
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
See Also