Fast Scatter Chart in WinUI (SfCartesianChart)
14 Jun 20242 minutes to read
A fast scatter chart is a special kind of series that can render a collection with huge number of data points using WriteableBitmap
. FastScatterBitmapSeries is used to render high number of scatter points.
The PointHeight and PointWidth properties are used to change the height and width of scatter segments. Type is used to change the rendering shape of fast scatter bitmap series.
The available shapes are
Cross
Diamond
Circle
Hexagon
InvertedTriangle
Pentagon
Plus
Rectangle
Triangle
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis />
</chart:SfCartesianChart.YAxes>
<chart:SfCartesianChart.Series>
<chart:FastScatterBitmapSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
PointHeight="7"
PointWidth="7"/>
</chart:SfCartesianChart.Series>
</chart:SfCartesianChart>
SfCartesianChart chart = new SfCartesianChart();
NumericalAxis xAxis = new NumericalAxis();
chart.XAxes.Add(xAxis);
NumericalAxis yAxis = new NumericalAxis();
chart.YAxes.Add(yAxis);
FastScatterBitmapSeries series = new FastScatterBitmapSeries()
{
ItemsSource = new ViewModel().Data,
XBindingPath = "XValue",
YBindingPath = "YValue",
PointHeight = 7,
PointWidth = 7
};
chart.Series.Add(series);