Articles in this section
Category / Section

How to draw horizontal line in WPF Chart (SfChart)?

1 min read

You can draw any shapes in WPF Chart (SfChart) using annotations. WPF Chart (SfChart) supports the following types of annotations, such as text, image, and shapes like line, rectangle, ellipse, horizontal line, and vertical line.

The following example illustrates the usage of HorizontalLineAnnotation in WPF Chart (SfChart). Here, CoordinateUnit determines whether the positioning is based on axis or pixel units, and CanDrag enables the support to drag or drop.

XAML

<!--Adding annotations to chart-->
<syncfusion:SfChart.Annotations>
    <syncfusion:HorizontalLineAnnotation Y1="39" CoordinateUnit="Axis" CanDrag="True" ShowAxisLabel="True"/>
</syncfusion:SfChart.Annotations> 

C#

private void MyChart()
{
  Annotation annotation = new HorizontalLineAnnotation();
  annotation.Y1 = 39;
  annotation.CoordinateUnit = CoordinateUnit.Axis;
} 

 

WPF Chart with Horizontal Line Annotation

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied