Pre loader

How to get absolute position of annotation?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I have a CompositeAnnotation and set CoordinateMode to RelativeX.

How to get absolute X position of the annotation in code behind?

<s:CompositeAnnotation.Annotations>
    <s:VerticalLineAnnotation
                              CoordinateMode="RelativeX"                               
                              IsEditable="True" 
                              CanEditText="True"
                              x:Name="MainAnnotation">
        <s:VerticalLineAnnotation.AnnotationLabels>
            <s:AnnotationLabel Text="My annotation"
                               CanEditText="True"
                               LabelPlacement ="Right"
                               />

        </s:VerticalLineAnnotation.AnnotationLabels>

    </s:VerticalLineAnnotation>
Version
4.1.1.8645
  • You must to post comments
1
0

I found a simple solution:

   protected override void OnAnnotationLoaded(object sender, RoutedEventArgs e)
    {
        base.OnAnnotationLoaded(sender, e);

        MainAnnotation.X1 = this.X1;
    }
  • You must to post comments
0
0

A bit tricky, but it is possible.

Try this code:

double xCoord = Canvas.GetLeft(annotation);
double xDataValue = XAxis.GetDataValue(xCoord);

Best regards,
Andrew

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies