Jump to content

XY-graph: programmatically add point "labels"


Go to solution Solved by Jordan Kuehn,

Recommended Posts

Hello to everybody,

 

I'm wondering to find a solution to this problem...

 

I have an xy-graph and I would like to insert programmatically some text label connected to certain x-y coordinates of the plot itself.

 

Does somebody know if it is possible? ... and have an idea on how to implement such behaviour?

 

Thanks

Max

Link to post
Share on other sites

There is built in functionally to do this but I find it lacking. Instead I use the graph method to translate the point coordinate to a pixel coordinate, then use the picture primitives to draw text, arrows, or other features, and place the resulting picture in one of the graph's plot image layers.

Link to post
Share on other sites

You could use a slide with text labels and put it above the scale. Make the slide transparent so that you only see the scale. Now you have to transfer the scale setting from the plot scale to the slide scale and define the appropriate label. But if the scales of the plot are not fixed you need to change the size of the slide using splitter bars because the plot area changes if the plot scales display different numbers. Its quite difficult to implement but the additional label is not in the plot area as in mje much simpler solution.

Link to post
Share on other sites

I believe the built in function mje was referring to is the graph cursors.  Right click the graph go to Visible Items and choose cursors.  Then you can make a cursor that will snap to existing points.  There are several examples if you search the example finder.  One is called Programatically Control Cursors but I have seen some other's that work better and can and and and point out the maximum value of a graph.

 

Again if these functions don't meet your needs you can just draw a picture and put it on top of the plot using the property nodes of the graph it self.

Link to post
Share on other sites
.... you can just draw a picture and put it on top of the plot using the property nodes of the graph it self.

 

Thanks hooovahh but my problem is that I don't know the final position of each label nor the amount of labels I have to insert...

 

Max

Here's a brief example how to draw your own images on plots. The VI simply tracks the x-location of the mouse and draws a circle around the corresponding data point. You could use whatever logic you want (closest Cartesian point, tracking multiple plots, whatever) and draw any info you'd like, but this should get you started if the built in functionality doesn't suffice.

interesting solution, I suppose usable also in LV2012...

 

I will make a try...

 

Max

Link to post
Share on other sites
  • Solution

I worked on something much like this before, but never wound up fully finishing or using it.  Here is code that is meant to be called in an event structure for a "mouse up" event in a Waveform Graph.  It expects the control reference, the coordinates (both returned by the event) and a name to put on the annotation.  See if this does what you want.

 

post-19157-0-99028400-1385145728_thumb.p

 

  • Like 1
Link to post
Share on other sites

For having text labels on your plotted graph you shouldn't take my solution. It's for textlabels in the x- or y-axes scale where you don't want to have a programmatic restriction in the number of labels.

 

For your task cursors or annotations are the best solution as the others suggest.

Link to post
Share on other sites

ShaunR  :beer_mug: 

 

you are true, it was not the best way to check both the solutions received... So I changed to the one I used mostly...

 

Attached the portion interested...

 

Thanks again

Max

post-787-0-11356800-1385395900_thumb.png

Edited by machyaer
Link to post
Share on other sites
  • 4 months later...

Green icons are OpenG toolkit functions.  You can install OpenG with VIPM.

 

 

Here's a brief example how to draw your own images on plots. The VI simply tracks the x-location of the mouse and draws a circle around the corresponding data point. You could use whatever logic you want (closest Cartesian point, tracking multiple plots, whatever) and draw any info you'd like, but this should get you started if the built in functionality doesn't suffice.

 

attachicon.gifMouse Tracking.png

attachicon.gifMouse Tracking LV13.vi

 

 

 

I just used annotations yesterday to mark things on a graph, and reacquainted myself with their limitations.  I think I’ll try your picture solution.

Link to post
Share on other sites

Join the conversation

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

Guest
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.

  • Similar Content

    • By Paul Liu
      Hi All,
      I am a new user to LabView and this is my first project using it. The project requires me to read a massive spreadsheet from Excel into LabView and then allowing the user to do the following:
      - Select which columns to plot against the first column
      - Use a cursor to select a portion of the spreadsheet: the Vi will then average the selected data by column (in other words, if the user selects data across multiple columns, the program will average data in each column separately). Then write the averages to the csv file.
      So far, I have the spreadsheet read into a table as strings (because the first row of the spreadsheet is words). I have spent a lot of time searching how to allow the user to select data on the table to perform operations on, but to no avail. I am hoping you guys could give me some insight on how to tackle this project.
    • By Christian Butcher
      I'm writing some LabVIEW software to store and display data from a variety of data sources, mostly through an NI DAQ board.
      I'm displaying the data (stored in an SQLite database) on an XYGraph.
      I would like to have a toggle-able, probably semi-transparent box listing each of the plots on the graph, with the option to turn the plots on/off by clicking, along with some grouping of similar plots (all temperature measurements, or all measurements from experiment #5, etc).
      The Bloomy post at http://www.ni.com/newsletter/51918/en/ gives me semi-transparent panels pretty easily (in fact, this can conceivably be tri-state, since I have on, off and invisible :D)
      I've already programmed a simple multi-column listbox for something else in this project that switches symbols and handles double-click, mouse up/down, etc, so I could maybe use a modified version of that to hold my plots.
      I have never successfully used an XControl for anything, but when I come to problems involving collections of strange custom controls, I always think, is this what an XControl is for?
      So, do I need an XControl here? Or will I just be diving into another rabbit-hole leading to yet another unsuccessful XControl attempt? If so, what should I be using instead?
      In case it matters, the bulk of the project uses NI's Actor Framework to handle separate sections, and the graph is inside a subpanel, inside another subpanel.
      Some images of current pieces. The parent holds the scrollbar, and my current no-op (except show/hide on the little menu button bottom left) overlay (not at all transparent). The child holds the actual graph, and an ugly global variable mean (I needed it quickly for a colleague's use...). The child is embedded in a subpanel of the parent (above the scrollbar) and the parent is embedded in a subpanel of the MainUI's 'Actor Core.vi'.
       


    • By Gan Uesli Starling
      Granted that I could do this very thing with two single-stack charts of 3 traces each. I could do that... However...
      What I'd very much prefer is to have 1 chart with 2 stacks and 3 traces on each.
      So my question is...Can I do that? And if so, how can I do that?
      I'll tell you what this is for...
      I have a test stand measuring pressure and flow. I want to show the current value for each in a separate, vertically stacked plot, with also the current max and min limits as dotted red lines. The settings are progressive steps, each with a different max and min for both those values. I want the operator to not have to think, only just look at the cart, and to know in an instant if it is performing amiss. Also an aid to troubleshooting. Save me a lot of headaches and interruptions down the road.
       
    • By ijustlovemath
      I just recently had a need for XY chart functionality in my application. The example NI has on its website was a little too simple, as I needed support for multiple curves. I've attached the VI and some examples, would love to hear any critiques you have.
       
       
      XYChart.zip
    • By nikp
      Hello,
       
      In matlab the plot data can be save as a *.png,*.jpeg, and so on and even a pretty good option *.fig. Later when the *.fig is opened you have the real plot as before and this can be edited like changing the legeng , x and y labels, color of the plot etc,.
       
      Is there any option like this in labVIEW. I  have seen options like saving the data into excel and to different image formats. Is there any special tool kit or add in functions??
×
×
  • Create New...

Important Information

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