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.


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


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?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment