We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Labeling a few points in line chart

Hi there,


I'm working on an application that uses SfChart line chart to display live data (updated a few times per second). This is the same application I talked about in my 2 previous posts. The chart data contains a few thousand points. On each refresh, I want to add labels to a few points (max 20 points) selected in the ViewModel. I want to mark points with some marker, it can be a circle and write it's X and Y next to it. Also I want these labels not to overlap.


I tried adding a trackball to each selected point, but the trackballs disappeared after the chart update and it looked bad. I could use annotations but I'd have to add 2 annotations for each point (shape annotation to mark a point and text with X-Y info).


I saw that SfChart offers the ability to show labels for each point of the chart. Is there a way to show them only for selected points? Or is there another way to mark some points?


1 Reply

SS Sowndharya Selladurai Syncfusion Team April 24, 2023 01:46 PM UTC

Hi Piotr,

I have attached a sample for reference that demonstrates how to use the DataMarkerLabelCreated event to mark specific points using the MarkerType and MarkerColor properties in SfChart.


Chart, line chart

Description automatically generated

Reference:
https://help.syncfusion.com/xamarin/charts/datamarker#datamarkerlabelcreated.

I hope this helps. Let me know if you need further assistance.


Regards,

Sowndharya.


Attachment: LabelCustomization_d98eac63.zip

Loader.
Up arrow icon