SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & 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 Stackoverflow.com 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.

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.