Jump to content

How to add plot labels in a graph?


Recommended Posts

Hello,

Assuming that there is a waveform graph with many plots.

If there are too many plots then there will be havoc on screen.

Is there any way to point/click with the mouse or use the cursor and have a label that shows the name of the plot in question?

Thank you in advance

Link to comment

I've done this a few ways. The easiest way is to use a graph's built in cursors to display the information when you pin the cursors to a plot (right click a graph, visible items: cursor legend).

Adding a layer of complexity, if the built in display isn't appropriate for your UI, you could still use the cursors but keep the UI hidden, and use the mouse move events to extract the appropriate information via property nodes and display it in your own indicators.

Even more complex, you can roll your own so to speak:

  • Have a tooltip VI running in the background which can receive data from the VI that has the graph.
  • Use a mouse move event to calculate the nearest point to the cursor. The graph has a method to transform screen coordinates to the coordinate space of the graph (or vice versa) to help with this.
  • Pass whatever information you need to your tooltip VI.
  • The tooltip VI receives the data and shows itself at the proper location, usually as a floating window.
  • When the mouse leaves the graph, don't forget to notify the tooltip VI so it knows to hide itself.

Doing it this way means your tooltip can literally be anything, as the appearance is defined entirely by another VI. Here's an example of a tooltip that appears in an application of mine when you hover over a data point:

post-11742-0-53021300-1317997390_thumb.p

Link to comment

Another display option could be visually changing the appearance of the plot to "highlight" it to show that it was "clicked" or "selected" and then scroll the plot legend to show which plot that was. Conversely, you can click on a plot name in the legend and it can "highlight" the corresponding plot in the graph.

I've wrapped all this up in XControls; works great. In the screenshot below, the red plot was clicked. The legend scrolled to bring the corresponding plot on the top and also highlighted the plot name (in blue).

post-9308-0-74554100-1318254437_thumb.pn

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.