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

0
0

Are there any examples existing for creating a custom annotation which consists of an arrow and a textbox. It would also be useful if the position of the text box / end of arrow could be changed by dragging the annotation. Attached is an image of the kind of thing I am trying to achieve.
I need to add these annotations dynamically as the user clicks on a point.

Images
  • You must to post comments
0
0

You need to bind their coordinates, please, try following this way:

                <s:LineArrowAnnotation HeadLength="4"
                                       HeadWidth="8"
                                       IsEditable="False"
                                       X1="50"
                                       Y1="35"
                                       X2="{Binding X1, ElementName=txt}"
                                       Y2="{Binding Y1, ElementName=txt}" />

                <s:TextAnnotation IsEditable="True"
                                  x:Name="txt"
                                  Text="Buy!"
                                  X1="10"
                                  Y1="30.5" />

Is it something like you want to achieve?

Best regards,
Yuriy

  • BeckyHayter
    Yes this is similar to what I want to achieve. However I need to be able to add the annotations dynamically at runtime and I do not know how many of them there will be. This means I cannot declare them in the xaml (except for possibly using a control template).
  • Andrew
    Hi Becky,The equivalent code for the above is sciChartSurface.Annotations.Add(new TextAnnotation(){ X1 = ... Y1 = ...});You can bind in code, or just set the data-values. I'm sure you've seen it but there is a good tutorial on annotations and their properties here.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.