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

0 votes

I downloaded the SciChartTeam SciChart version release from Git , thinking I would be able to get myself educated regarding Composite Annotations , which is something that has been requested by our field engineers.
The reference however given in the xaml file gives me :


within the solution. That reference does not include any source files (see attached image)

Since Composite Annotations is fairly complex, code examples and a working example solution, showing Composite Annotations implemented would be extremely helpful for me. Is there a running example I can download / view/ interact with ?

Appreciate support in this matter

Thank you


1 vote


I Need some help within the composite annotation resizing.

I created a composite annotation based on the composite annotations example. I need to calculate the range between to vertical line on the surface, so I took the MeasurmentXAnnotation.xaml as base code of mine.

however i need to be able to resize the composite annotation not only from the 4 edges (ResizingGrips), but also when the user drag the line annotations to left or to right.

Is there any way to achieve this?

Best regard

0 votes
0 answers

I have created a composite annotation that consists of four elements: two VerticalLineAnnotations, a BoxAnnotation, and a TextAnnotation. When I first add the annotation, everything appears correctly. However, when I change between tabs in my TabControl… the BoxAnnotation disappears. The box will reappear when I move the composite annotation a few pixels.

Note: Calling ZoomExtents() or InvalidateElement() does not fix the issue.

I’ve created a simple app to reproduce the issue.


<s:CompositeAnnotation x:Class="WpfPresentation.Views.PeakAnnotation"

    <s:VerticalLineAnnotation CoordinateMode="Relative" Stroke="#FFBADAFF" StrokeThickness="2" X1="0" X2="0" Y1="0" Y2="1"/>
    <s:VerticalLineAnnotation CoordinateMode="Relative" Stroke="#FFBADAFF" StrokeThickness="2" X1="1" X2="1" Y1="0" Y2="1"/>
    <s:BoxAnnotation x:Name="box" Opacity="0.2" CornerRadius="2" Background="#FFBADAFF" BorderBrush="#1964FF" CoordinateMode="Relative" X1="0" X2="1" Y1="0" Y2="1"/>
    <s:TextAnnotation x:Name="AnnotationTextLabel" CoordinateMode="Relative" X1="0" Y1="0.95" FontSize="12" Foreground="White"/>


public partial class PeakAnnotation : CompositeAnnotation
    public PeakAnnotation()


    public PeakAnnotation(string annotationText)
        AnnotationTextLabel.Text = annotationText;

    public string StyleKey { get; set; }

    public Type ViewType => throw new NotImplementedException();


public MainViewModel()
        ChartTitle = "Testing";

        Annotations = new AnnotationCollection();

        var myAnnotation = new PeakAnnotation("My Annotation Title")
            X1 = 40,
            X2 = 50,
            Y1 = 0,
            Y2 = 100

    public string ChartTitle { get; set; }
    public AnnotationCollection Annotations { get; set; }


<Window x:Class="SciChartTesting.MainWindow"
    xmlns:local="clr-namespace:SciChartTesting" xmlns:s=""
    Title="MainWindow" Height="450" Width="800">

    <local:MainViewModel x:Key="MainViewModel"/>

<Grid DataContext="{StaticResource MainViewModel}">
        <TabItem Header="TabOne">
            <Label Content="This is TabOne"/>
        <TabItem Header="TabTwo">
            <s:SciChartSurface ChartTitle="{Binding ChartTitle}" Annotations="{Binding Annotations}">
                    <s:NumericAxis VisibleRange="0,100"/>
                    <s:NumericAxis VisibleRange="0,100"/>

0 votes
0 answers

Is there a way to add grip handles to the left-center and right-center of a box annotation. By default, grip handles are only created on the four corners of the box. See the attached image. Currently I am creating my annotations in the code behind and view models, not XAML.

If a composite annotation needs to be created, that is fine.

0 votes

hello, i have a problem, my TestAnnotation class X Y is null when creating.


public class TestAnnotationViewModel : CompositeAnnotationViewModel
    public override Type ViewType
        get { return typeof(TestAnnotation); }

public class TestAnnotation : CompositeAnnotation
    public TestAnnotation() : base()
        DefaultStyleKey = typeof(CompositeAnnotation);

    public override void Update(ICoordinateCalculator<double> xCoordCalc, ICoordinateCalculator<double> yCoordCalc)
        base.Update(xCoordCalc, yCoordCalc);

        //i want to do some thing, but X1 Y1 X2 Y2 is null, and i get exception.
        //this code from Composite Annotations Examples
        if (Y1.CompareTo(Y2) > 0) // <===exception
            MeasureText.VerticalAnchorPoint = VerticalAnchorPoint.Top;
            MeasureText.Margin = new Thickness(0, 5, 0, 0);
            MeasureText.VerticalAnchorPoint = VerticalAnchorPoint.Bottom;
            MeasureText.Margin = new Thickness(0, -5, 0, 0);

version v5.3.0.11954

1 vote

I am trying to add a “LineArrowAnnotation” using a composite annotation.
When I run my code (see below) I get an exception (also below).
When I put “AnnotationCoordinateMode” in AnnotationCoordinateMode.Absolute,
it will show the LineArrowAnnotation, but on the wrong place.

When I run my code I get the following exception:

‘NaN’ is not a valid value for property ‘Y1’.

And this is the stack trace:

   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at SciChart.Charting.Visuals.Annotations.LineArrowAnnotation.c4fae01a1bd9d8777f0acbea006c37ddd(AnnotationCoordinates cb7eea21dddaf59b654790a03f7fecf82, LineArrowAnnotation c7816e538855bcbae71ae0f6efa624460)
   at SciChart.Charting.Visuals.Annotations.LineArrowAnnotation.ca698bc0a82170c849e74a3955c194cda.PlaceAnnotation(AnnotationCoordinates coordinates)
   at SciChart.Charting.Visuals.Annotations.AnnotationBase.PlaceAnnotation(AnnotationCoordinates coordinates)
   at SciChart.Charting.Visuals.Annotations.AnnotationBase.MakeVisible(AnnotationCoordinates coordinates)
   at SciChart.Charting.Visuals.Annotations.AnnotationBase.Update(ICoordinateCalculator`1 xCoordinateCalculator, ICoordinateCalculator`1 yCoordinateCalculator)
   at SciChart.Charting.Visuals.Annotations.CompositeAnnotation.Update(ICoordinateCalculator`1 xCoordinateCalculator, ICoordinateCalculator`1 yCoordinateCalculator)
   at SciChart.Charting.Visuals.Annotations.AnnotationBase.TryUpdate(ICoordinateCalculator`1 xCalc, ICoordinateCalculator`1 yCalc)
   at SciChart.Charting.Visuals.Annotations.AnnotationBase.Refresh()
   at SciChart.Charting.Visuals.Annotations.AnnotationBase.ccc682ea04b7d185ec619d8e3262c6d9b()
   at SciChart.Charting.Visuals.Annotations.AnnotationBase.OnAnnotationLoaded(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

This is the code I use to draw the “LineArrowAnnotation”:

var line = new LineArrowAnnotation
     X1 = (double)annotation.MeasureFrom,
     X2 = (double)annotation.MeasureTo,
     Y1 = 0.9d,
     Y2 = 0.9d,
     Padding = new Thickness(0, 20, 0, 20),
     HeadLength = 4,
     HeadWidth = 6,
     //ToolTip = annotation.Tooltip,
     SnapsToDevicePixels = true,
     //CoordinateMode = AnnotationCoordinateMode.Absolute,
     CoordinateMode = AnnotationCoordinateMode.RelativeY,
     Stroke = new SolidColorBrush(color),
     StrokeDashArray = new DoubleCollection { 2, 2 },
     Tag = annotation,
  • Kevin Goos asked 4 years ago
  • last active 4 years ago
5 votes


I am trying to create a XABCD pattern annotation. Currently, I am able to create the XA, AB, BC, CD legs using LineAnnotation then add the two remaining XB and BD lines programmatically. However, when creating the LineAnnotations, I am not getting the real-time feedback between the 1st and 2nd clicks. I have full source code but from what I can see, all SciChart annotations are at most, limited to 2 clicks. I’ve read through the Fibonacci composite annotations which are close to what I’m trying to achieve but only allow interaction by 2 clicks since they’re based on BoxAnnotation.

I am currently using full MVVM with a custom derived class from AnnotationCreationModifier per this article: Editing annotations and keeping track of them in an mvvm application combined with the Multi-Pane Stock Chart example. For the PatternAnnotationViewModel, I am using dependency properties for X, A, B, C, D so they are bindable if needed.

Huge thanks in advance,

Psuedo code
1st click
Place point X portion of XA LineAnnotation, begin visual feedback for point A
2nd click
Place point A
Set beginning of AB to A, begin visual feedback for point B
3rd click
Place point B
Set beginning of BC, begin visual feedback for point C
Draw XB LineAnnotation
PolygonFill XAB region
4th click
Place point C
Set beginning of CD, begin visual feedback for point D
5th click
Place point D
Draw BD LineAnnotation
PolygonFill BCD region

Desired Functionality

Undesired Functionality

0 votes

I created CompositeAnnotation consisting of several elements (VerticalLineAnnotation).
I set visibility CompositeAnnotation to hidden but does not work.

How can I do it?

Showing 8 results
This template supports the sidebar's widgets. Add one or use Full Width layout.