WPF Charting Documentation - SciChart WPF Charts SDK v5.x
The LineArrowAnnotation Type

The LineArrowAnnotation type draws a line with arrow head from X1Y1 to X2Y2, where coordinates are data-values.

 

 

Declaring a LineArrowAnnotation in XAML

Declaring a LineArrowAnnotation
Copy Code
<!-- Where xmlns:s="http://schemas.abtsoftware.co.uk/SciChart" -->
<s:SciChartSurface>
   <s:SciChartSurface.Annotations>
      <!-- Declares a LineArrowAnnotation at X1=1, X2=2, Y1=4, Y2=6 -->
         <!-- The annotation will move with the chart as you zoom and pan -->
      <s:LineArrowAnnotation Stroke="#555" StrokeThickness="2"
                              X1="1" X2="2" Y1="4" Y2="6"
                              IsEditable="True"/>
   </s:SciChartSurface.Annotations>
</s:SciChartSurface>

Declaring a LineAnnotation in Code

Declaring a LineAnnotation
Copy Code
var sciChartSurface = new SciChartSurface();
sciChartSurface.Annotations.Add(new LineArrowAnnotation()
{
   Stroke = new SolidColorBrush(Colors.FromArgb(0xFF, 0x55, 0x55, 0x55)),
   StrokeThickness = 2,
   X1 = 1,
   X2 = 2,
   Y1 = 4,
   Y2 = 6,
   IsEditable = true,
});

Templating the LineArrowAnnotation

The Default Style and ControlTemplate for the LineArrowAnnotation is defined below. You shouldn’t need to change this, but if you want to template the annotation, here are the template parts:

Templating the LineArrowAnnotation
Copy Code
<Style BasedOn="{StaticResource AnnotationBaseStyle}" TargetType="a:LineArrowAnnotation">
   <Setter Property="Stroke" Value="{me:ThemeBinding RubberBandStrokeBrush}" />
   <Setter Property="StrokeThickness" Value="2.0" />
   <Setter Property="Template">
      <Setter.Value>
         <ControlTemplate TargetType="a:LineArrowAnnotation">
            <Grid x:Name="PART_LineArrowAnnotationRoot">
               <Line x:Name="PART_GhostLine"
                    Stroke="Transparent"
                    StrokeThickness="{s:Static
                     Member=visuals:ManipulationMargins.AnnotationLineWidth}" />
               <Line x:Name="PART_Line"
                    Stroke="{TemplateBinding Stroke}"
                    StrokeDashArray="{TemplateBinding StrokeDashArray}"
                    StrokeThickness="{TemplateBinding StrokeThickness}" />
               <Polygon x:Name="PART_ArrowHead"
                      Fill="{TemplateBinding Stroke}"
                      Stroke="{TemplateBinding Stroke}"
                      StrokeThickness="{TemplateBinding StrokeThickness}" />
            </Grid>
         </ControlTemplate>
      </Setter.Value>
   </Setter>
</Style>

 

 


SCICHART ® is a Registered Trademark in the UK, US and EEC. Copyright SciChart Ltd 2011-2018.

Email us to give feedback!