Skip to content

"Stack" vs "Relative" barmode #27

@meetamit

Description

@meetamit

Hi There,

First off, thanks for making and open-sourcing this library; it is proving very useful.

I wanted to propose a tiny code change to 2 lines in the instantiation of the plotly renderers in PlotlyRenderes.jsx. Specifically, I'm wondering if the layout options passed into the two stacked bar charts could specify { barmode: 'relative' } instead of { barmode: 'stack' }.

There may be reasons not to do it, which I'm not aware of, because I'm far from intimately familiar with plotly.js. However, the reason pro doing it is that currently, with { barmode: 'stack' }, if there are any negative values in the data, their bars end up overlapping and covering up other bars instead of sticking out on the negative side of the chart. In other words, as far as I can tell, when there are negative values, 'stack' mode results in a bug while 'relative' mode does what you'd expect. And I don't think there's a case where the opposite is true.

The only discussion I've found about this so far is this forum post in which someone points out this issue and Etienne addresses by creating the new { barmode: 'relative' }. However, no explanation is given as to why a new mode was needed instead of modifying the 'stack' mode.

Thanks for your consideration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions