Possible duplicate question to Bar chart in Javascript: stacked bars + grouped bars
I'm trying to create a stacked bar chart that lets you compare 2 values (dark and mid blue) to last week's data points (the secondary light blues 'behind').
Starting with
multiBarChart()
with.stacked(true)
first I tried merging both weeks into a single array of 14 bars, where thex
position could help group the bars. I tried to form my combined array of objects where.x
properties' values are0
,0.3
,1
,1.3
,2
,2.3
, etc. Unfortunately unlikelineChart()
it doesn't use thex
value for positioning.Another idea is to exploit the group
.stacked(false)
, providing 4 items (instead of 2) with the samex
value. These then appear overlaid on top of each other instead of stacked. Here the spacing looks good, but how do I stack these 2 by 2?