stacked barchart legend is upside-down
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.
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();
};
Good idea, thanks.
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.