LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bar graph won't plot enough bars

Solved!
Go to solution

Hi all.  I'm making a subVI for a work project.  Both myself and my boss have run out of ideas and the deadline's drawing near!!

 

I'm a noob to Labview but I'll try to explain what my subVI does (or should do).

 

Basically my subVI reads in 24 channels of data from a VI.  My subVI should then turn these elements of data into an array and output 24 seperate bars on a bar graph to represent the voltage level of each channel. 

 

This it does, however, the graph only shows 20 channels and no more.

 

I know for a fact that the SubVI recieves all 24 channels and processes (if that's the right word) the se 24 channels all the way to the end.  But no matter what I do I can't get the graph to display the last 4 channels.

 

Both myself and my boss (who know a lot more about Labview than me!) are stuck.  Please help!!

 

I have attached my subVI.  It is commented, so hopefully it will be a lot easier to understand by looking at it rather than me try to make ham-fisted attempt at explaining it in words! (Test bar graph 2)

 

I have also attached the orginal bar graph VI that I adapted to make my subVI (Bar graph example)

 

One final thing: "Bar graph example" was made in LV 10 and "Test bar graph 2" was made in LV 8.6 - because it had to be compatible with previous VI's.  Sorry!  (Bloody labview and it's non-compatibility issues!)

Download All
0 Kudos
Message 1 of 5
(3,306 Views)

Noooooo!!!!!

 

OK, the bar graph example has virtually no resemblance to the other VI. What is the significance? Whay does it have a chart???

 

The subVI is a Rube Goldberg construct beyond belief and probably could be done with 1% of the current code. Could you make it so that the "array" contains some typical default data so we can actually test? 

 

Do you really need different colors for all the bars?

0 Kudos
Message 2 of 5
(3,302 Views)
Solution
Accepted by topic author Kahinde

Your location array only has 10 elements, thus the location loop will only spin 10 times, and not 12 due to autoindexing.

 

Try something like the attached. It does about the same as your code. To change the x-axis spacing, modify dx, no need for the locations array)

 

Download All
0 Kudos
Message 3 of 5
(3,288 Views)

Brilliant help, cheers!

 

Thanks to you, I've got got my "Rube Goldberg machine" 😄 working (Test bar graph 3), and I've also modified your and got that working too (Test bar graph 4).

 

Just for future reference: To get the Rube Goldberg  working I just had to right-click on the array on the front panel and click Data Operations -> Insert Element Before, then add two more elements and re-number them from 0-55

 

I'm going to use your version; much more simple, plus it numbers each bar 0-23.

 

Still, I'm not ashamed of my Rube Goldburg! Afterall, part of becoming a good programmer is making mahoosive code and then learning how to make it small and clever 😄

 

Thanks again

 

PS. LV colours each bar graph automatically.  For the purpose of my subVI it's a good thing anyway

Download All
0 Kudos
Message 4 of 5
(3,246 Views)

Kahinde wrote:

Still, I'm not ashamed of my Rube Goldburg! Afterall, part of becoming a good programmer is making mahoosive code and then learning how to make it small and clever 😄


Note that you could send the raw input array directly to the graph and you would get the same graph, but all bars in the same color. That might be sufficient for all practial purpose.

 

Looking at the two VIs you have attached, they are still more complicated than really needed..

 

  • If you use index array, you don't need to wire the indices if you want the elements in order.
  • For "bar graph 4" there is no need to index and build the array, a plain wire is sufficient. (see image 1) (If the input array is too large, a simple reshape or subset can be used to get an array containing the first 24 elements.
  • If you want the graph have the same x-axis as the "Rube" example, set the dx=2.5.
  • Your Rube example is fundamentally flawed because you make the y arrays 12 time larger than needed and the extra data is lost again when graphing. All the FOR loops (except the one for the x-ramp) can be deleted without change in overall outcome. (see image 2).
  • Why do you have 24 empty array constants? One would be enough. You can branch the wire?

 

Image 1:

 

 

Image 2: 

 

Download All
0 Kudos
Message 5 of 5
(3,224 Views)