LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get bar plot stacked in one graph?

Hi there,

I am having a problem trying to get a stacked bar plot in one graph. I attached two images to show you what it looks like now and how I would like it to look.

At the moment I am making two x,y clusters, bundle these into an array and give that as input to the XY graph. This gives me the image where the bar plots are shown next to each other. However, I want them to be shown on top of each other and I cannot find a way to do this.

I searched this forum and the help and looked at the available properties for the XY graph, but it seems impossible. So I was wondering if anyone here is able to help me solve this.

Thanks in advance,

Steph.
Download All
0 Kudos
Message 1 of 13
(5,765 Views)
Your easiest method would probably be to use an excel chart inside an activex control.
0 Kudos
Message 2 of 13
(5,745 Views)
Have you taken a look at the "Stacked Bar Graph" example that ships with LabVIEW? Help->Find Examples, then enter "stacked" in the search tab.
Message 3 of 13
(5,740 Views)
I am trying the ActiveX now.
Thanks for the hint on the example, I though I had had a look at everything related to bar plots in the example but had not seen this one yet. I'll have a look and try to find out how they did it...
0 Kudos
Message 4 of 13
(5,736 Views)
Ok definitely works by the way as done in the example: just adding the value of the one to the other, so that it is higher. Quite simple actually.. sometimes you just think too difficult 🙂
Thanks for the help!
0 Kudos
Message 5 of 13
(5,727 Views)

There really should be no reason to use ActiveX here.  Did the example help?

To get them to overlap like you want you shoul djust need to change the plot type to bar, and make sure that the 2 arrays have the same x values.

Can you attach the VI you used to make the plot you don't want, so we can see how to modify it so it will work?

0 Kudos
Message 6 of 13
(5,713 Views)
Hi All,
   I actually wanted to do the same thing, make a stack graph. I am very new at this, and I looked at the stack example that comes with labview. It does not appear to do what I want. The example seems to make everything in percentage and also, is that an XY graph icon?


Thanks!
Eileen
0 Kudos
Message 7 of 13
(5,660 Views)
The normalization is controlled by a Boolean control. If you look at the block diagram of the example you will see it's calling a subVI that takes in a "normalize?" input, which is defaulted to True. If you set this to False then you won't get it normalized to 100%.

That is not an XY Graph. It's a Waveform Graph.
0 Kudos
Message 8 of 13
(5,657 Views)
Thanks! Maybe I am not understanding the terminology and a "stack graph" may not be what I am looking for, but here is my small example.

DATE DATA 1 DATA 2
1/2008 3 4
2/2008 4 8.5
3/2008 6.58 38.9


I would like to do a bar graph where DATA 1 AND DATA 2 overlap each other like Steph's example of a stack graph.
and the "DATE" will be on 'x-axis'  while data 1 and data 2 will be values show on the y-axis. (Note: data 1 will always be data 2, it will show up with two colors where one color is always taller than the other).

Is this stack graph the right path? I am new at using the graphing icons in Labview, I do not even know how to I would go about loading these as inputs to the VI.

Please advise me on the right path. Thanks again!

Eileen
0 Kudos
Message 9 of 13
(5,646 Views)
Hi Eileen,

I think you should be able to do it with a stacked bar plot. What the example VI does is adding the values of the first column to the values of the second column. This means that the data2 values will be on top of the data1 values, thus stacked. You can just copy the code from the example VI and use it in your own VI this also gives you the ability to delete the whole case structure for the percentage calculation.

If you want the right values to show on the y-axis as you have them now, you should not stack them but just plot all the values in one bar plot. If you are certain that data2 is always bigger than data1, you can give two data arrays as one input cluster to the graph, which will then draw two bar plots on top of each other. But this will only work if one data stream is always bigger than the other, otherwise you will not be able to see all data. If data2 is not always bigger than data1, it is better to show the two bars next to each other, so add a small displacement in all the x values for one of the data streams.

I do not have Labview at the pc I am using at the moment, so I cannot send you my code.. but I hope this helps a bit!

Steph.


Message Edited by StephK on 03-19-2008 01:20 PM
0 Kudos
Message 10 of 13
(5,641 Views)