How to change the series marker symbol type in .NET MAUI Chart(SfCartesianChart)?
This article provides a detailed walkthrough on how to modify the series marker symbol type in the .NET MAUI Chart (SfCartesianChart). Learn step-by-step instructions and gain insights to customize the series marker symbol.
Step 1:
To show the marker in the series, set the ShowMarkers property to true.
[XAML]
<chart:SfCartesianChart>
. . .
<chart:AreaSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue" Fill="#FCECF4" Stroke="#E4061C" StrokeWidth="2" ShowMarkers="True">
</chart:AreaSeries>
</chart:SfCartesianChart>
[C#]
SfCartesianChart chart = new SfCartesianChart();
...
AreaSeries series = new AreaSeries()
{
XBindingPath = "XValue",
YBindingPath = "YValue",
ItemsSource = new ViewModel().Data,
Stroke = Color.FromArgb("#E4061C"),
StrokeWidth = 2,
Fill = Color.FromArgb("#FCECF4"),
ShowMarkers = true,
};
chart.Series.Add(series);
Step 2:
To customize the series marker appearance, create an instance of the MarkerSettings property. It provides support to change the series marker symbol type with the help of the Type property in ChartMarkerSettings. User can also customize the marker by using the Fill, Width, Height, Stroke, and StrokeWidth properties of ChartMarkerSettings.
[XAML]
<chart:SfCartesianChart>
. . .
<chart:AreaSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue" Fill="#FCECF4" Stroke="#E4061C" StrokeWidth="2" ShowMarkers="True">
<chart:AreaSeries.MarkerSettings>
<chart:ChartMarkerSettings Type="Rectangle" Fill="#E51328" Height="15" Width="15"/>
</chart:AreaSeries.MarkerSettings>
</chart:AreaSeries>
</chart:SfCartesianChart>
[C#]
SfCartesianChart chart = new SfCartesianChart();
...
ChartMarkerSettings chartMarker= new ChartMarkerSettings();
chartMarker.Type = ShapeType.Rectangle;
chartMarker.Fill = Colors.FromArgb("#E51328");
chartMarker.Height = 15;
chartMarker.Width = 15;
AreaSeries series = new AreaSeries()
{
XBindingPath = "XValue",
YBindingPath = "YValue",
ItemsSource = new ViewModel().Data,
Stroke = Color.FromArgb("#E4061C"),
StrokeWidth = 2,
Fill = Color.FromArgb("#FCECF4"),
ShowMarkers = true,
};
chart.Series.Add(series);
Output
Conclusion
I hope you enjoyed learning how to change the series marker symbol type in .NET MAUI Chart (SfCartesianChart).
You can refer to our .NET MAUI Chart feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI Chart documentation to understand how to present and manipulate data.
For current customers, check out our .NET MAUI from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Chart and other .NET MAUI components.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!