How to disable or modify the tooltip on a graph

Oystein Bjorke 4 years ago 0
This discussion was imported from CodePlex

laranto wrote at 2013-07-07 17:56:

Hi everybody!!

Please help me!!

You know that when a graph is displayed a fantastic tooltip come in your help to display the coordinates of the mouse selected point.

But I've to display two graphs on the same diagram which are properly scaled so that the max Y value of both the graphs are the same.

It follows that the scaled Y obtained from the tooltip are not representing the originals but the scaled.

So I need to interfere with the mechanism of the tooltip to modify the displayed values or, if it is not possible, to disable the tooltip from one of the graph.

To display the graph I use a PlotModel object to which property PlotModel.Series I next add a LineSeries which represent the graph to display.

Can anyone gime me some feedback?

Thank you very much

everytimer wrote at 2013-07-07 19:50:

Create properties (X', Y') with INotifyPropertyChanged interface implemented that represents the X and Y transformed coordinates. Then add an event to the desired LineSeries (as shown in the examples MouseEvents):
                yourLineSeries.MouseDown += (s, e) =>
                       {
                           if ((e.ChangedButton != OxyMouseButton.Left))
                           {
                               return;
                           }

                      //Here catch the screenpoint
                      //Transform to coordinates of your LineSeries
                      //Apply the scaling X'=a*X, Y'=b*Y
                           e.Handled = true;
                       }; 
The last step is to bind via XAML that properties to the tracker. See the custom tracker examples.

Good luck

laranto wrote at 2013-07-08 13:00:

Thank you very much!!!

I've tried to implement your solution without reaching the goal to obtain a tooltip with a scaled versions of the point coordinates.

I've to give a result as soon as possible.

So I ask you: please is there a fast way to disable the tooltip for a certain LineSeries?

Thank you very much!! :D

raphay wrote at 2013-07-08 16:58:

I think you only need to handle the event
yourLineSeries.MouseDown += (s, e) =>
                       {
                           if ((e.ChangedButton != OxyMouseButton.Left))
                           {
                               return;
                           }
                           e.Handled = true;
                       }; 

laranto wrote at 2013-07-08 17:19:

It's true!!!! Thank you very much raphay :D
CodePlex