LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph Challenge

I'm looking for suggestions on how to create a graph which is easy to imagine, but appears difficult to implement in LabVIEW.
- first, imagine a XY graph with a single group of three plots. These three plots never intersect (they were calculated as max, min, and mean from each row of a dataset). I want to fill the plot between the max and the min line with a solid color and still have the mean line visible.
So far, it's easy; plot the mean first, and then add the max and min lines, and fill between them.
- now, imagine several more groups of three lines similar to the first group. Unfortunately, these groups may intersect each other.

I'd like to be able to see every group, and even better, shade the areas where the groups intersect.

The simple solution is to make the fill color semi-transparent. Someone, please tell me that this is possible in 8.2.1 🙂 I've considered a complicated solution where I create a separate set of plots for each contiguous section of a group, but this gets complicated very quickly (for two groups, it seems pretty managable, but as the number of groups increases, and the potential number of distinct overlapping regions grows, the number of plots required skyrockets).

I've also attempted to do this using a .NET library called Zedgraph. It can make very nice graphs and use an alpha channel to make the fill area semi-transparent; however, its ability to fill between two plots appears to be very limited.

I am open to all options: other graphing libraries, trying some magic with the picture control, etc.

I've attached a vi containing a XYgraph control with some data. I've laid it out like I described at the beginning of this question. This particular dataset doesn't overlap too much, but I need to be able to handle arbitrary datasets.

I hope this makes sense. Thanks.
Chris


Message Edited by C. Minnella on 04-22-2007 10:58 PM

Download All
0 Kudos
Message 1 of 16
(7,420 Views)

I would say go with the picture control, as it allows you to have the flexibility you need, but it will be complicated.

If you look in the Picture Plots palette, you should have some starting point. You can use the Draw Multiple Lines VI to create your filled shapes.

Transparency is a little more complex - I believe you need to average the values of each old pixel with your new pixel by breaking them up into their RGB components, adding those components and then dividing and building the picture back and this is probably a slow process. There might be a faster way, so you should try searching for information about averaging and combining multiple images.

As another option entirely - how about the 3D graph? Can you use it to create semi-transparent planes and draw your graphs on those planes?


___________________
Try to take over the world!
Message 2 of 16
(7,396 Views)

3d graph supports transparency on a plot basis.

Ben

Message Edited by Ben on 04-23-2007 07:51 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 16
(7,348 Views)
(OK, you can disregard this. The transparency appears to be the issue here. My bad Smiley Surprised )


Just a thought, but have you checked out the example in the Example Finder called Limit Example.vi? You can just search for the keyword limit to find it. It shows an example of using a Fill Plot on a waveform graph. You can choose to plot one signal as being filled to another signal instead of just being a line. You can fill to positive or negative infinity, to zero, or to any other plot of your choice. It looks like you could use this to construct your graphs. To select a fill plot, just right click the plot in the legend and select Fill Base Line and then select the other plot to fill to. Would this suffice?

Message Edited by Jarrod S. on 04-23-2007 10:47 PM

Jarrod S.
National Instruments
0 Kudos
Message 4 of 16
(7,325 Views)
Okay, it looks like Ben showed me the way. I was all prepared to figure out how to use a picture control with multiple images for the plots averaged together, but if the guru of picture controls says there is another way, I'll take a look. I had to stare at the 3DGraph control for a while before I figured it out, but here's a pic. I used the max and min lines to define a surface as a single plot in a single plane (the Z's are all zero), and drew the mean line as a separate plot for each group. Set the transparency for the surfaces, set the graph to view the XY Plane (or any other...), and clean it up by dropping it on top of a normal graph control. I'll include a vi when I have an opportunity to clean the code up.


Message Edited by C. Minnella on 04-24-2007 07:33 AM

Message 5 of 16
(7,302 Views)

Very nice C. Minnella!

I think you have proven (once again) that "a picture is worth a thousand words"!

Don't you just love LabVIEW?

Please try to rember to follow through with an example when you get it cleaned up.

Thank you!

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 16
(7,279 Views)
So, I decided to tackle this problem as an xControl. It was instructive. Here's an example of a program using my xControl. It is functional enough that I will use it in an application, but I'd love to hear some commentary on how it works. There seem to be some incredibly annoying race conditions inherent in the way xControls are implemented (I've heard LV9.0 will fix these...); I punted and went with Waits. I tried an approach with Semaphores, but it didn't really solve the problem as I can't wait on a semaphore until I'm already in the problem vi, which means it was called with the wrong Display State already (and waiting won't fix it). I started switching over to a queue based approach, but the problem would still be there because I can't force all interaction with the Display State case of the facade VI through my queue.

One thing I could have done to mitigate the problem is change the way the plot names get set, but I really wanted the control interface to work like the built-in controls (i.e., Active Plot... Plot Name). I guess my punt torched that thought, but its too late now...

Anyway, any comments would be appreciated. Use Example VI for a look. The code is in 8.20.


Message Edited by C. Minnella on 06-10-2007 11:30 PM

Download All
Message 7 of 16
(7,148 Views)

Ressurecting an old thread here I see, but how can I produce this graph? I've been tinkering with the 3d-plot with no luck so far.

0 Kudos
Message 8 of 16
(5,139 Views)

MinellaAC attached a zip file.  Did you open that up to see how he did it?

0 Kudos
Message 9 of 16
(5,114 Views)

I mean the 3D-solution, not the UpperLowerGraph. I opened the xcontrol and tried to add a property such that I could change the x-axis to logarithmic. The result was that the x-axis was re-written, but not the actual graphs. I tried to look into the write functions but couldn't make it work. I really need the log-function, so I figured the 3D-surface solution would be better, but the 3D-surface has no zip attached.

0 Kudos
Message 10 of 16
(5,088 Views)