Discussion:
dynamically creating multiple graphs
(too old to reply)
m_min
2008-08-05 02:10:06 UTC
Permalink
Dear all LV gurus, I have some problems creating multiple graphs dynamically. The application is to read the values from database but the channels are variables so that the graphs need to be loaded are changing from time to time. For example, I might need to load 12 graphs(channels) for one station and for another station, I might need to load 19 graphs(channels). I have an idea but i guess it's like hand coded and not flexible. My idea is too have a VI make it include maximum number of graphs. And when loading, according to the number of graphs, it will make visible only the required number of graphs. any idea?BR,min
Karissa
2008-08-05 07:10:04 UTC
Permalink
Not sure if you wanted to display multiple channels on one graph or actually display separate graphs. 19 Graphs on the one screen might get hard to read do you have an idea of a kind of layout you want to use?Have a look at this example which might be something like your after. It shows an example of letting the user select channels to display on a single graph and displaying multiple graphs using an array. The array method doesn't update very well though and all graph properties have to be exactly the same.You could also use re-entrant VIs that pop-up but this might get annoying to an operator too.


Multiple Channel Select_LV80.vi:
http://forums.ni.com/attachments/ni/170/346568/1/Multiple Channel Select_LV80.vi
m_min
2008-08-05 07:40:05 UTC
Permalink
I have tested with 19 plots on one graph and it's messy as u said. Also I tried with array values showing one graph at a time. It's ok and i could do that. I am sorry that my previous post  might have made u confused, the main thing is I wanna show like 19 graphs on one VI and let the user print so that the user can print all graphs in one or a few pages(instead of one graph per page). My idea was pre-loading all maximum number of graphs, then make them(unnecessary ones) invisible when loading like 12 channels. But as you know calling properties of each VI needs lots of wiring and there are literally 20 cases. So I was hoping for someone could show me how to do it programmatically.
m_min
2008-08-05 07:40:05 UTC
Permalink
Dear Karissa, Forgot to say thank you. Your idea of stack plots is nice. Best regards,min
Jennifer_R
2008-08-05 21:10:05 UTC
Permalink
Hi min,
Both of the suggestions in Karissa's example are great ideas. 
Another option is to create an array of references to each of the Waveform Graphs.  The example below allows the user to set the visibility of each graph. 
 
<img src="Loading Image...">
&nbsp;
For your application, you could use a for loop to programmatically change the visibility of the graphs depending on the number of channels.&nbsp; Message Edited by Jennifer_R on 08-05-2008 03:40 PM


Graph Visibility.PNG:
http://forums.ni.com/attachments/ni/170/346878/1/Graph Visibility.PNG
m_min
2008-08-07 12:40:08 UTC
Permalink
Dear Karissa, I intend to use your stack multi graph method but the problem is the Y-scales differences. It seems like all graph shares the only one scale so some of the graphs are not even showing at all. Pls advice.Regards,min
Dennis Knutson
2008-08-07 19:10:06 UTC
Permalink
You must have changed something because the example has auto-scaling turned on for the Y axis on all graphs and all graphs are separate so there is no 'sharing' of scales unless you program it to be that way. So,
m_min
2008-08-08 02:10:06 UTC
Permalink
Dear Dennis, I was using Karissa's example program, not Jeniffer's one.
Dennis Knutson
2008-08-08 02:40:06 UTC
Permalink
Sorry, I missed the reference to Karissa and thought you were talking about the Jennifer's. Since Karissa's is an array, they all have to have the same properties. Jennifer's would work since each graph is separate. The listbox idea in Karissa's could still be used for selecting how many to display.
m_min
2008-08-08 06:40:15 UTC
Permalink
Dear Dennis, Thanks for your advice. I really need to use Karrisa's stack plots as I have channels not in fixed numbers, varying from 9 to 24 with different Y-axis scales and i guess it's not possible to do with separate graphs as in Jennifer's example. If you have some ideas, pls advice,regards,min
Jennifer_R
2008-08-11 14:10:06 UTC
Permalink
Hi min,
<a href="http://zone.ni.com/devzone/cda/epd/p/id/89" target="_blank">Here's</a> an example of using multiple y-axis scales on the same chart.&nbsp; You can follow the same steps for a graph.&nbsp;
Karissa
2008-08-11 02:40:05 UTC
Permalink
You can't have different Y axis scales in an array, they all have to be the same. You'll need to use Jennifer's method to have different Y scales.
Continue reading on narkive:
Loading...