Plotly.js: Bar stackgroup

Created on 7 Mar 2019  路  10Comments  路  Source: plotly/plotly.js

We should finish the swing from https://github.com/plotly/plotly.js/issues/3402 and implement stackgroup for bar. Needed for px.

feature

Most helpful comment

Any updates on this? We would love a real grouped stack bar charts, like the one @etpinard mentioned above:

https://github.com/plotly/plotly.js/issues/3614#issuecomment-488830695

But with mixed line charts as well, like so:

linebar_projection_bar

All 10 comments

@nicolaskruchten could you tell us a bit more about the current limitations of barmode: 'stack' for px?

I have a feeling making examples like:

image

(from https://github.com/plotly/plotly.js/issues/1835#issuecomment-372308444) work as

Plotly.newPlot('graph', [{
  type: 'bar',
  x: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
  y: [3, 4, 4, 2, 5],
  marker: {color: 'black'},
  offsetgroup: '1',
  stackgroup: '1'
}, {
  type: 'bar',
  x: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
  y: [7, 3, 4, 7, 2],
  marker: {color: 'blue'},
  offsetgroup: '1',
  stackgroup: '1'
}, {  
  type: 'bar',
  x: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
  y: [3, 0, 4, 4, 3],
  marker: {color: 'orange'},
  offsetgroup: '2',
  stackgroup: '2'
}, {
  type: 'bar',
  x: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
  y: [2, 5, 6, 2, 1],
  marker: {color: 'green'},
  offsetgroup: '2',
  stackgroup: '2
}], {
  // !! no barmode !!
})

will require at least a full week of work - as it will require a subsequential refactoring of Bar.crossTraceCalc.

In addition, we'll probably need to add another trace attribute (named e.g. stackmode) to toggle between the barmode: 'stack' and barmode: 'relative' stacking behavior for a given stackgroup.

I'm imagining stackmode working in a similar way to stackgaps in scatter traces - where we use the "first" value found.

After some review, I can no longer think of the case(s) where this would be useful for px, and nothing has come up recently in that repo's feature requests, so if we can continue with bingroup without stackgroup then let's skip this one for 1.48.

Is this blocking #85, out of curiosity?

I can no longer think of the case(s) where this would be useful for px,

Ok, thanks for the info.

if we can continue with bingroup without stackgroup then let's skip this one for 1.48.

That's the solution I currently prefer. I'll try to get a PR up for bingroup w/o stackgroup early next week

Is this blocking #85, out of curiosity?

Not really, we could add an attribute (e.g. showstacktotal) that would get coerced only when barmode: 'stack'.

That's the solution I currently prefer. I'll try to get a PR up for bingroup w/o stackgroup early next week

So this is on hold? We could really need something like this in plotly:
image

Hi @etpinard
what is the status on this topic? I'm very curious if the option to make stacked+grouped chart is already possible.
Thanks.

We don't have an ETA yet for this issue but we're still planning on addressing it :)

Any updates on this? We would love a real grouped stack bar charts, like the one @etpinard mentioned above:

https://github.com/plotly/plotly.js/issues/3614#issuecomment-488830695

But with mixed line charts as well, like so:

linebar_projection_bar

Closing in favour of sponsored feature: #4914

Was this page helpful?
0 / 5 - 0 ratings