machyaer Posted November 22, 2013 Report Posted November 22, 2013 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 Quote
mje Posted November 22, 2013 Report Posted November 22, 2013 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. Quote
unicorn Posted November 22, 2013 Report Posted November 22, 2013 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. Quote
hooovahh Posted November 22, 2013 Report Posted November 22, 2013 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. Quote
machyaer Posted November 22, 2013 Author Report Posted November 22, 2013 thanks for the replies, I'm not sure that all the solution proposed should solve the problem... for this reason I attached an example image... I will try unicorn solution that perhaps should function... Max Quote
Popular Post mje Posted November 22, 2013 Popular Post Report Posted November 22, 2013 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. Mouse Tracking LV13.vi 3 Quote
machyaer Posted November 22, 2013 Author Report Posted November 22, 2013 .... 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 Quote
mje Posted November 22, 2013 Report Posted November 22, 2013 The picture functions are nearly as old as time itself, I'm not sure how far back the plot image properties go back, but at least as far as 2009. I've saved the VI for 2012: Mouse Tracking LV12.vi Quote
Jordan Kuehn Posted November 22, 2013 Report Posted November 22, 2013 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. 1 Quote
unicorn Posted November 25, 2013 Report Posted November 25, 2013 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. Quote
machyaer Posted November 25, 2013 Author Report Posted November 25, 2013 I tried the mje solution and found a good compromise. Than I've tryed to mix mje and jordan solutions... and here we are!!! This is the right solution. Thank! Max Quote
hooovahh Posted November 25, 2013 Report Posted November 25, 2013 Than I've tryed to mix mje and jordan solutions... and here we are!!! This is the right solution. Did you mean to attach something to that post? Quote
Jordan Kuehn Posted November 25, 2013 Report Posted November 25, 2013 Yes, I would also be interested to see how you combined the two approaches. Quote
ShaunR Posted November 25, 2013 Report Posted November 25, 2013 Yes, I would also be interested to see how you combined the two approaches. Especially as he marked his answer as Best Answer" to his own question. Now. Where are all my posts . 2 Quote
machyaer Posted November 25, 2013 Author Report Posted November 25, 2013 (edited) ShaunR 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 Edited November 25, 2013 by machyaer Quote
wildcatherder Posted March 26, 2014 Report Posted March 26, 2014 I could probably use this solution on a current project. Unfortunately, I have no idea what functions the green icons represent. Is there any way to get an image posted that has the function labels turned on? Quote
drjdpowell Posted March 27, 2014 Report Posted March 27, 2014 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. Mouse Tracking.png Mouse 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.