Category / Section
How to change the data marker symbol type in Chart
1 min read
Essential chart for Xamarin.Forms provides support to add data markers to adorn the data points with shapes and labels. It is enabled by setting the ShowMarker property to true. You can change the shape that appears on the data point using the MarkerType enum property.
The following code illustrates how to use the MarkerType property.
XAML
<chart:LineSeries XBindingPath="Month" YBindingPath="Books" ItemsSource="{Binding Data}" > <chart:LineSeries.DataMarker> <chart:ChartDataMarker ShowLabel="False" ShowMarker="True" MarkerColor="Red" MarkerType="Diamond"/> </chart:LineSeries.DataMarker> </chart:LineSeries>
C#
LineSeries line = new LineSeries(); line.XBindingPath = " Month "; line.YBindingPath = "Books"; line.ItemsSource = dataModel.Data; line.DataMarker = new ChartDataMarker { ShowLabel = false, ShowMarker = true, MarkerType = DataMarkerType.Diamond, MarkerColor = Color.Red, };