How to change the size of scatter series in WPF Chart (SfChart)?
Description:
Scatter series plots an ellipse for each data point with definite size and fill. You may have to entail the variance in its size and color, especially when you have more than one series. This article describes how to change the size and color of scatter series.
Solution:
You can change the height and width of scatter series by using ScatterHeight and ScatterWidth properties in WPF Chart (SfChart). These values are pixel values and the default value for both properties is 20d. Also the Interior property is used to fill the ellipse as like other series.
These properties are also open for FastScatterBitmapSeries that you can use for high performance requirement.
XAML
<chart:ScatterSeries ScatterWidth="25" ScatterHeight="25" Label="Normal" Interior="DarkRed" XBindingPath="Year" YBindingPath="StandardRoom" ItemsSource="{Binding}"/> <chart:ScatterSeries ScatterWidth="60" ScatterHeight="60" Label="Double" Interior="Red" XBindingPath="Year" YBindingPath="DoubleRoom" ItemsSource="{Binding}"/> <chart:ScatterSeries ScatterWidth="40" ScatterHeight="40" Label="Luxury" Interior="Blue" XBindingPath="Year" YBindingPath="ExecutiveRoom" ItemsSource="{Binding}"/>
C#
(this.scatterChart.Series[0] as ScatterSeries).ScatterWidth = 25; (this.scatterChart.Series[0] as ScatterSeries).ScatterHeight = 25; (this.scatterChart.Series[1] as ScatterSeries).ScatterWidth = 60; (this.scatterChart.Series[1] as ScatterSeries).ScatterHeight = 60; (this.scatterChart.Series[2] as ScatterSeries).ScatterWidth = 40; (this.scatterChart.Series[2] as ScatterSeries).ScatterHeight = 40;
Output:
Conclusion
I hope you enjoyed learning how to change the size of scatter series in WPF Chart.
You can refer to our WPF Chart feature tour page know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF Chart Examples to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!