11-02-2011 12:09 PM
What I am doing:
I have LabVIEW 2011. I am creating multiple random number generated XY plots.
I am creating annotations to show the furthest point in each plot.
What is happening:
When the last points in each plot are close, the names and arrows overlap.
I want to be able to fix this.
I was thinking of keeping a collection of Y positions of each annotation that is created and ordering them relative to the average of each plot.
Anyone think of a better idea?
Solved! Go to Solution.
11-04-2011 12:11 PM
Hi ADrexel,
Are you able to upload the code to this forum?
Regards,
11-04-2011 12:16 PM
Yes but I do not have LabVIEW on this computer. Here is the file I work with. I am not sure the current status of the code. I last worked on it 2 weeks ago. I have tried different ideas but nothing would be considered a good solution.
I wish I could view the code with like a LabVIEW Block Diagram Viewer... but that does not exist.
I hope you have LV2011
11-08-2011 02:50 PM
Hi ADrexelDragon,
I was looking at your VI and I have two ideas that I would think will work for you, the first is that instead of collecting all the Y positions, and this is a for loop with a finite iterations number, you just need to compare the last Y value and if the difference between Y1 and Y2 is less than the minimum, change a little bit the plotting coordinate for the names. The second option that you can consider is to place the plot names out of the graph, with the name and the reference color for the plot.
I hope this will help you.
Regards,
11-08-2011 02:55 PM
Thanks for the response.
I have thought about assigning names to the legend.
If I don't do that, the first option sounds doable. Is there a way to have a box outlined the name of the plot? Or maybe make the text bold?
Thanks,
Nick
11-08-2011 07:44 PM
Interesting questions. The answer depends on what you really want to achieve. For instance, if the number of plots is larger than H/h, where H is the height of your graph (the black area) in pixel and h is the height of an annotation string, then whatever solution you find to position your annotations, they will overlap unless you stagger them horizontally as well...
Assuming that you will never be in this situation, you could find the min Y and max Y of your graph Display and follow either of these two conventions:
1) list the annotations from Graph1 to Graph N, giving annotation n (= 0, ..., N-1) a Label Offset.Y = max Y - (n+1) (max Y - min Y)/(N+1) - last Y
(this can be messy).
2) list the annotations from largest final Y to smallest final Y.
Check out the attached modified code.
11-08-2011 08:51 PM - edited 11-08-2011 09:00 PM
I like your example. I would definitely use the "Last Coordinate Order" rather than the plot order. Thank you.
I added a feature to change the color of the name based on the plot. See attached.
Also, I am still wondering if it is possible to add a box around the name. I think that would be something really cool to add onto the graph. Also, if the box had background color capabilities that would overlay the graph.
11-09-2011 12:49 PM
These properties are not accessible, unfortunately.
If you have suggestions for Annotations, post them in the NI LabVIEW Idea Exchange Forum (link back to your original post if you don't want to rewrite everything).
I have my own qualms with annotations... And the graph objects have received their fair share of complaints too...