SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.


How to create custom annotation which has BoxAnnotation with a VerticalLine Annotation at one end.

At present I’m achieving this by creating both annotations and synchronizing them in ChartModifier.
Look at the attached image where you can see two BoxAnnotations both having a VerticalLineAnnotation at one end. I’m disabling editing for BoxAnnotation and enabling editing only for VerticalLineAnnotation.

When VerticalLineAnnotation is dragged in X-Direction, I get the X1 value from it and manually set it to BoxAnnotations X2.

This is not good implementation. I can see lag between sync events. Is it possible to create a custom annotation which incorporates both Box and Vertical line annotations ? Or is it possible to set IsEditing for BoxAnnotations One End only ?

  • You must to post comments
Best Answer

Hi Jerome,

There is no way in SciChart to create a Composite Annotation e.g. combine two or more annotations into one annotation.

However, you can achieve what you want by using bindings between annotation properties. For instance, I have modified our existing Drag Horizontal Threshold example with the following code:

    <s:SciChartSurface Grid.Column="1"
                        SeriesSource="{Binding ChartSeries, Mode=OneWay}"
                        ViewportManager="{Binding ViewportManager, Mode=OneWay}" >

            Y1="{Binding Threshold, Mode=TwoWay}" />

           <!-- Binds to VerticalLineAnnotation and Axis properties -->
           <!-- to create a filled area below the threshold --> 
            <s:BoxAnnotation CoordinateMode="RelativeX" X1="0" X2="1" 
                            Y1="{Binding ElementName=horizLine, Path=Y1, Mode=OneWay}"
                            Y2="{Binding ElementName=yAxis, Path=VisibleRange.Min, Mode=OneWay}" 

            <s:NumericAxis  VisibleRange="0.0, 10.0" AutoRange="Always"/>

            <s:NumericAxis x:Name="yAxis" VisibleRange="-1.0, 1.0" AxisAlignment="Left" AutoRange="Always"/>

            <s:LegendModifier ShowLegend="True" Margin="10" LegendTemplate="{StaticResource LegendTemplate}"/>

This results in this behaviour below. I can’t see any lag between the drag of the HorizontalLineAnnotation and position of the BoxAnnotation.

enter image description here

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.