Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stacked barchart legend is upside-down #704

Open
d2a-raudenaerde opened this issue Sep 17, 2014 · 3 comments
Open

stacked barchart legend is upside-down #704

d2a-raudenaerde opened this issue Sep 17, 2014 · 3 comments
Labels
Milestone

Comments

@d2a-raudenaerde
Copy link

When stacking barcharts, the 'stacked' units are added from the bottom, for example the first stacked group (stack1) is above the base group (base). In the legend however, the items are added from the top to the bottom, i.e. stack1 is below base. Please keep them in the same order.

@d2a-raudenaerde
Copy link
Author

The stack mixin needs a reverse().

_chart.legendables = function () {
    return _stack.map(function (layer, i) {
        return {chart:_chart, name:layer.name, hidden: layer.hidden || false, color:_chart.getColor.call(layer,layer.values,i)};
    }).reverse();
};

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Sep 17, 2014
@gordonwoodhull
Copy link
Contributor

Good idea, thanks.

@emiguevara
Copy link

I don't think it is such a good idea to just reverse the order of labels, although exposing the possibility of sorting them sounds good.
Currently, the user has a list of labels in the order of the stacks. When the stacks are passed dynamically, they will be most probably sorted decreasingly (as different groups in a crossfilter dimension usually are), which means that the greatest stack will be at the top of the legend and the user can immediately start interacting with it.

gordonwoodhull added a commit that referenced this issue Sep 16, 2015
cherry-picking @vprus's fix from master (#702/#704)
tests are still massively broken and won't be fixed!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants