I want to create a stacked bar chart that uses time series data, i.e. the x-axis contains times.
I don’t believe I can do this with the Bar Chart component.
If I use the (Classic) Chart Component I can set the type to XY Bar Renderer.
This almost does what I want. However the bars are not stacked, they appear behind one another.
Here is an example using the classic chart (set to XY Bar Renderer):
I know I can sort of achieve this using the standard Bar Chart but as per this example, there is no data between 10am and 9am the next day, so the graph shows a gap, which is exactly what I want. But had I supplied the same data into the standard Bar Chart then I wouldn’t have got the gap.
I hope this makes sense. Is there a way to achieve this?
Having tried to do this using the standard bar chart it is not ideal at all, particularly when you get data that spans over a few days. I can’t set my categories to be just hours, e.g. “08:00”, “09:00”, “10:00” etc because as soon as I get into the next day then any data at the same time gets grouped with data from the previous day, i.e. all the “08:00” data gets put together.
So I have to have my labels as “Tue 08:00”, “Tue 09:00” , … , “Wed 01:00”, “Wed 02:00” etc meaning the labels are getting long, so I rotate them to 90 degrees but it still displays every single one so it’s looking very cluttered and not very user friendly.
Plus as stated previously if I didn’t have any data for a particular hour it would just be missed, I wouldn’t automatically get a gap.
Hmm… for a purely visual effect you could add a dataset to the chart to hold the “stacked” data. Basically, you’d add to the previous values:
headers = list(dataIn.getColumnNames())
for row in pyData:
for col in range(2,len(row)):
I say purely visual, because, of course, the subsequent values get changed.
Jordan - thanks that is an interesting idea, was completely confused by what you meant at first but then suddenly it clicked.