Skip to main content
10-Marble
May 5, 2022
Question

Stacked Bar Comparisons

  • May 5, 2022
  • 1 reply
  • 1795 views

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

 

 

1 reply

10-Marble
May 5, 2022

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

Support
May 5, 2022

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

10-Marble
May 6, 2022

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