Horizontal line in SfChart?

Is there any easy way to add horizontal static line to line chart without creating additional series?

3 Replies

SM Saravanan Madheswaran Syncfusion Team November 6, 2017 10:17 AM UTC

Hi Xetal,

Thanks for using Syncfusion Products.

You can achieve this requirement by extending the ChartBehavior class and override the OnDraw method. In this method, we can drawn the horizontal static line(or other custom shapes) on top of the line chart. We have prepared a sample for your requirement and it can be downloaded from the below location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SimpleSample-842253023.zip  

Please let us know, if you need further assistance on this.

Thanks,
Saravanan

 



PS Peter Somos replied to Saravanan Madheswaran March 25, 2022 02:26 PM UTC

Hi Saravanan!


Is there a possibility to have a similar solution not only for Android, but for UWP & iOS as well?

The posted sample works only for Android, but I would need it for all 3 platforms.

Or could you suggest a whole different solution for the following issue?

I have a SfChart, and I have a treshold value. For this treshold value I'd like to have a horizontal line, which tells the user, if a value in the chart is below or above this treshold value.


Thank you for your answer!



YP Yuvaraj Palanisamy Syncfusion Team March 28, 2022 12:23 PM UTC

Hi Peter Somos, 
 
You can achieve your requirement “Horizontal line in the Syncfusion SfChart control” with the help of HorizontalLineAnnotation support. Please find the following link to describe this each platform. 
 
Xamarin.Forms: 
 
Xamarin.Android: 
 
Xamarin.iOS: 
 
UWP: 
 
Please let us know if you have further assistance. 
 
Regards, 
Yuvaraj. 


Loader.
Up arrow icon