Pre loader

Annotation Label Popup

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

Hi guys,

I am trying to solve another problem and i would like to know if you could suggest me the best way .
I have already seen the Annotation examples but i need to place an annotaion Datetime (this works) , but on this annotation i need to place a “label” at the top which appears only when the user moves over with the mouse.

See attached file.

Cheers,
Giouseppe

Images
  • You must to post comments
0
0

Hi there,

Sorry for late reply, we where investigating your case and found a bug connected with it. This behavior can be easily implemented when label is placed on axis:

    public class VerticalLineAnnotationWithFloatingLabel: VerticalLineAnnotation
    {
        public VerticalLineAnnotationWithFloatingLabel()
        {
            MouseEnter += OnAnnotationMouseEnter;
            MouseLeave += OnAnnotationMouseLeave;
        }

        private void OnAnnotationMouseLeave(object sender, MouseEventArgs e)
        {
            ShowLabel = false;
        }

        private void OnAnnotationMouseEnter(object sender, MouseEventArgs e)
        {
            ShowLabel = true;
        }
    }

And there is attached solution which implements it for all label placements, but it probably won’t work for you because of this bug we’ve found. To workaround it, you could try to override IsPointWithinBounds method for VerticalLineAnnotation:

public class VerticalLineAnnotationWithFloatingLabel: VerticalLineAnnotation
    {
        public override bool IsPointWithinBounds(System.Windows.Point point)
        {
            var rootGrid = AnnotationRoot as Grid;

            var tPoint = rootGrid.TranslatePoint(point, rootGrid);

            bool withinBounds = (tPoint.X <= rootGrid.ActualWidth && tPoint.X >= 0)
                                && (tPoint.Y <= rootGrid.ActualHeight && tPoint.Y >= 0);

            return withinBounds;
        }
    }

Use this class instead of VerticalLineAnnotation in attached solution.

Please, let us know if it helps!

Best regards,
Yuriy

  • You must to post comments
Showing 1 result
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