Pre loader

Modifying tooltip placement on a SciChartSurface

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,

I want to use a CursorModifier with a TooltipContainerStyle in a SciChartSurface to display a tooltip. I would like to modify the default behavior that places the tooltip to the bottom and right of the cursor, and place the tooltip at bottom center instead.

Is this possible, and if so, how?

We are using SciChart 4.0.2.8024 in our project.

Of course, I can always use the tooltip’s ActualWidth to tweak its Margin accordingly, but I would like to know if there is a simpler solution than that, before I do this.

  • You must to post comments
0
0

Hello Yuriy,

I have been busy with other things lately, but have not forgotten this issue.

I ended up implementing a fix using my first approach, but since I have now run into some problems with it, I will now try your proposal.

Thank you,
Sami

  • You must to post comments
0
0

Hi there,

Thanks for your inquiry. Unfortunately, we don’t provide API to change the default tooltip placement. It is possible to change it doing a little overridding though.

So you should override the HandleMasterMouseEvent method, then retrieve the tooltip from ModifierSurface and finally change its position. Please try the following code:

        protected override void HandleMasterMouseEvent(Point mousePoint)
    {
        if (ModifierSurface != null)
        {
            var tooltip = ModifierSurface.Children.OfType<CursorLabelControl>().FirstOrDefault();

            if(tooltip != null)
            {
                Canvas.SetLeft(tooltip, mousePoint.X - tooltip.ActualWidth/2);
            }
        }
    }

Please let us know if this helps,

Best regards,
Yuriy

  • 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