cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Stacked Bar Comparisons

Saran_Rockwell
6-Contributor

Stacked Bar Comparisons

Hello Developers,

 

I'm having a requirement where i need to show bar chart for current year data and previous year data as shown below.

 

Saran_Rockwell_0-1651715897440.png

In the first chart I need to show stacked bar for the current year and for the previous year side by side to show the comparison. I'm not able to figure out how to achieve this.

 

I'm able to get the current year stacked bar with a data shape like below

Location (x axis)

Type 1

Type 2

Type 3

Type 4

Now what would be the ideal data shape or approach to show the stacked bar for both the years.

 

Regards,

Saran

 

 

5 REPLIES 5

One more feature we are expecting in the chart is that will it be possible to show the data based on the legend selection.

 

Like if the user click on the type 1, then only the type 1 bar is shown in the chart.

 

Regards,

Saran

Hi @Saran_Rockwell 

 

What version of ThingWorx are you running?

 

For the standard bar chart widget in ThingWorx 9.x, there is a SeriesDisplay option that will allow you to set it to stacked. 

 

To answer your last question, in 9.x there is a LegendFilter option in the Properties panel that will allow for user selection between types.   

 

Regards.

 

--Sharon

Hi Sharon,

 

ThingWorx 9.3.0 - This is the version im using. I was able to get the stacked bar chart for current year with the data shape as shown below

 

Location (x axis)

Type 1

Type 2

Type 3

Type 4

 

My doubt is when i include the previous year data like shown below, how will the chart widget identify that first stacked bar should include Type 1(CY),

Type 2(CY),Type 3(CY),Type 4(CY) and the second stacked bar will include Type 1 (PY),Type 2 (PY),Type 3 (PY), Type 4 (PY)

 

Data Shape for the Stacked bar comparison charts

Location (X axis)

Type 1(CY)

Type 2(CY)

Type 3(CY)

Type 4(CY)

Type 1 (PY)

Type 2 (PY)

Type 3 (PY)

Type 4 (PY)

 

Hope this explains my use case.

 

Regards,

Saran

HI @Saran_Rockwell

 

As long as the data is organized consistently from year to year, we don't perceive any problems.  What issues are you having?

 

Regards.

 

--Sharon

The legend filter option is useful.

Top Tags