Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to show a tooltip to identify a trace on WaveformGraph?

We would like the ID to pop up when a mouse is placed over the trace. Using C# in .NET
Thanks.
0 Kudos
Message 1 of 3
(3,593 Views)
Currently, there is no simple way to do this with 7.0. You can use the legend control to be able to identify the individual plots on a graph.

You might be able to use the screen coordinates to determine if the mouse is over a particular point on a plot and display a tooltip for that. But you will need to basically get the data for all the plots (using GetXData and GetYData), map the data points to screen coordinates (using MapPoint or MapData), and then in your PlotAreaMouseMove event, check to see whether the current mouse location is near any of the points (just comparing X and Y coordinates).

Here is my PlotAreaMouseMove callback. I have previously plotted some data on the waveformGraph.

private void waveformGraph1_PlotAreaMouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
Rectangle myBounds = waveformGraph1.Plots[0].GetBounds(); //you need to get the bounds for all the plots you might have on the graph. In my case, I just have one.

PointF myPoint = waveformGraph1.Plots[0].MapPoint(myBounds,5,5); //Im my case, I'm just checking to see if I can find the data points 5,5 using the mouse move event. This maps the data points (5,5) to the screen coordinates. The mouse move event returns the current position of the mouse in terms of screen coordinates

Size pointSize = waveformGraph1.Plots[0].PointSize;

Point anotherPoint = new Point((int)(myPoint.X - pointSize.Width/2),(int)(myPoint.Y -pointSize.Height/2));

Rectangle myRect = new Rectangle(anotherPoint,pointSize);

if( myRect.Contains(e.X,e.Y))
Debug.WriteLine("I found it");
}


We are providing additional functionality for the next release of Measurement Studio that might make this task a little simpler and easier.
If you are interested in evaluating this, please go to http://ni.com/beta to sign up for the beta. If you have any questions, please email the beta coordinator at mstudio.beta@ni.com .

Thanks

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 3
(3,593 Views)
Thanks. About what I had surmised from the documentation. Looking forward to the next release.
0 Kudos
Message 3 of 3
(3,593 Views)