From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help making a graph control with specific look

I would like to make a graph with some features to look like one created with Matlab. I am curious if anyone has any suggestions on how to do it. In the attached image and vi, my graph is on the left, and the one I am trying to duplicate is on the right. In particular, I would like to see the grid lines through the "shaded" area, and it would be nice to have a better way of placing text to mark the "Event" than using a cursor. I'm guessing that a picture control could be used, but I don't have very much experience with these; also, I'm not sure there is any way to control the level of transperancy of an object in LabVIEW. I am not particularly interested in the dashed grid lines.

Thanks
Chris

Message Edited by C. Minnella on 07-01-2005 04:20 PM

Download All
0 Kudos
Message 1 of 7
(2,710 Views)
Just a quick idea: You could switch off the grid lines and replace them with your own lines in an XY graph (you need to find out the tic mark positions, I'm not sure if that is possible). They could be placed on top of the coloured rectangle. It is not real transparency, but the effect comes close. AFAIK there is no transparency attribute in LV (yet).
 
A solution with picture controls is certainly also possible but may be less flexible. To get started with picture controls, you might want to look at one of the examples first, e.g. this one ...\examples\picture\demos.llb\XY Multi Plot.vi
 
 
0 Kudos
Message 2 of 7
(2,683 Views)
I am not entirely sure this would work, as I'm not at a computer that has LabVIEW on it (or anywhere near one), but I had a similar issue.  Depending on how you do the shading, you may already have done/tried this....

Try using a plot of your own that uses the Y-Scale, and goes from say, -50 to +50 at the time you want the window to start appearing.  Then when you want it to stop, go from +50 to -50.  In the properties of the graph, you under the plots tab, you can select "fill to 0" in a drop down box, and it will fill that plot from +50 to zero, and -50 to zero, but the effect will be the same as you've got (assuming that's not what you've done already).

I'm not positive, but I'm fairly sure that the gridlines will print over the plot...  Hope I'm not wrong!

Also, if you're seeing a bit of a slope on the side of the window you're making, make it go from +100 to -100...  the bigger the difference, the better (to a point anyways...)

Message Edited by Novatron on 07-02-2005 02:45 AM

0 Kudos
Message 3 of 7
(2,676 Views)

You can get pretty close with a few tweaks. See attached.

Message Edited by altenbach on 07-02-2005 12:23 AM

Download All
Message 4 of 7
(2,673 Views)
Thanks for the suggestions guys. For anyone curious what Altenbach did, here's a rundown:
1) as Fahlers suggested, the grid lines have been rendered transparent and an additional plot was added to create the appearance of grid lines
2) Altenbach also threw in a little tidbit that I guess I never thought to try; using (NaN, NaN) as a point coordinate effectively stops the drawing of the line (this allows one plot to be used for both the vertical and horizontal grid lines without having to connect them with a straight line.
3) A quick modification on my part requires almost half as many points to draw the grid (interpolation mode = 1) and is also how I drew the yellow window using only two points (basically as described by Novatron).
4) I'm a little curious how Altenbach placed the cursor text. It is nicely lined up with the cursor point now, whereas in my example, it was above and I had to add spaces to get it out from under the line.

Of course, this looks like the example I presented. The trick is to get it to react to varying x and y ranges and tick mark placement. I'll have to work on that a little to automate it.

Thanks for the help. I'll post my automated "grid line creation vi" when I get around to making it.
Chris
0 Kudos
Message 5 of 7
(2,649 Views)


@C. Minnella wrote:
4) I'm a little curious how Altenbach placed the cursor text. It is nicely lined up with the cursor point now, whereas in my example, it was above and I had to add spaces to get it out from under the line.

You can just "grab" the cursor text and move it relative to the cursor. Try it! 🙂
Message 6 of 7
(2,621 Views)

Just another note:

Alternatively, you could even control the relative position of the cursor legend programmatically using the trick that Ben discovered.

(See this example by CC . Of course that entire thread is wothy reading).

Message 7 of 7
(2,602 Views)