How to add straight lines to a chart, either vertical or horizontal

Hi,


I'd like to know if there is documentation, or can you advise, for how to add either horizontal or vertical straight lines to a chart?


The horizontal line would represent some value on the y-axis, and the vertical line would represent some value on the x-axis.


3 Replies 1 reply marked as answer

DD Devakumar Dhanapoosanam Syncfusion Team August 1, 2022 02:37 PM UTC

Hi Lorenzo,


Query: How to add straight lines to a chart, either vertical or horizontal


We can add the straight line horizontal or vertical by adding the VerticalLineAnnotation and HorizontalLineAnnotation in chart Annotations as per in the below code example.


<chart:SfChart.Annotations>

    <chart:HorizontalLineAnnotation  X1="-0.5" Y1="1500" X2="4.5"/>

    <chart:VerticalLineAnnotation X1="2.5"/>

</chart:SfChart.Annotations>


Please refer below link for more details and let us know if you need any further assistance.

https://help.syncfusion.com/wpf/charts/annotations#vertical-and-horizontal-line-annotation

https://help.syncfusion.com/wpf/charts/annotations#positioning-the-annotation

https://www.syncfusion.com/kb/2850/how-to-draw-horizontal-line-in-wpf-chart-sfchart


Regards,

Devakumar D


Marked as answer

LO Lorenzo August 2, 2022 05:51 AM UTC

Thanks very much.



DD Devakumar Dhanapoosanam Syncfusion Team August 3, 2022 05:05 AM UTC

Hi Lorenzo,


Thanks for your update.


Please let us know if you need any further assistance.


Regards,

Devakumar D


Loader.
Up arrow icon