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

Fix stacking, tooltip, and legend order for stackables #2027

Merged
merged 3 commits into from
Feb 17, 2016

Conversation

tannerlinsley
Copy link
Contributor

Stacked line and bar charts now behave predictably with the first
dataset on the bottom stacked upwards.

Legends can now be reversed with the reversed: true property.

Tooltips detect the stacked scale property now, reversing when
appropriate

Stacked line and bar charts now behave predictably with the first
dataset on the bottom stacked upwards.
Legends can now be reversed with the `reversed: true` property.
Tooltips detect the stacked scale property now, reversing when
appropriate
@@ -205,7 +205,7 @@ module.exports = function(Chart) {
var sumPos = 0,
sumNeg = 0;

for (var i = this.chart.data.datasets.length - 1; i > datasetIndex; i--) {
for (var i = 0; i < datasetIndex; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this affect stacked area charts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the datasets are now being passed into the core.controller updater function in reversed order (this ensures the datasets are drawn on top of each other instead of behind each other). The change here is just compensating for that reversal by traversing down dataset values, instead of up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! You're good to merge then

@etimberg
Copy link
Member

Looks good. Just want to confirm that stackedArea charts aren't broken. Checked the test failures ... they are due to coveralls.io being down.

tannerlinsley added a commit that referenced this pull request Feb 17, 2016
…e-legend

Fix stacking, tooltip, and legend order for stackables
@tannerlinsley tannerlinsley merged commit f572125 into v2.0-dev Feb 17, 2016
@tannerlinsley tannerlinsley deleted the fix-stacking-order-and-reversable-legend branch February 17, 2016 20:11
@dcm4c0
Copy link

dcm4c0 commented Apr 11, 2016

image
The "reverse" option only changes the legends but not the overlapping in the chart, am i missing an option here?

@tannerlinsley
Copy link
Contributor Author

legend: reverse: true doesn't affect the chart stacking, it simply
reverses the legend item order. You would probably need to
datasets.reverse() as there is nothing built in to chartjs to reverse the
order of your dataset items.

On Mon, Apr 11, 2016 at 2:33 AM Max [email protected] wrote:

[image: image]
https://cloud.githubusercontent.com/assets/15612612/14419731/1791cda2-ffc8-11e5-8c50-e4d689a9e09a.png
The "reverse" option only changes the legends but not the overlapping in
the chart, am i missing an option here?


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#2027 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants