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

Several bars, 2 y axis, one stacked bar #5557

Closed
ghost opened this issue Jun 9, 2018 · 13 comments
Closed

Several bars, 2 y axis, one stacked bar #5557

ghost opened this issue Jun 9, 2018 · 13 comments

Comments

@ghost
Copy link

ghost commented Jun 9, 2018

Hi

I have a chart with 6 data items: a,b,c,d,e,f
a,b,c are for the same axis/scale (left)
d,e,f are for the same axis/scale (right)

So far so good, with 2 datasets and 2 scales -> y axes, one left one right.

Now I made b and c stacked and linked to the left axis. The problem is that now the labels on the x axis are a bit off because it thinks it should draw another bar where it shouldn't (its value is 0). I tried xAxes: [{stacked: true}], but it didn't change anything.

Any hints/tips on how to achieve it?
Thanks

@Hedva
Copy link

Hedva commented Jun 11, 2018

Can you profide a jsfiddle?

@ghost
Copy link
Author

ghost commented Jun 11, 2018

Here it is: https://jsfiddle.net/e8n4xd4z/9385/

Now it's using version 2.7.2 and you can see the x labels are off because it is drawing another bar (0 value) which I don't need. Funny enough, If you change (on the left pane) to version 2.3.0, it will be drawn perfectly.

@ghost
Copy link
Author

ghost commented Jun 15, 2018

I added a jsFiddle, has anyone had the chance to have a look? it looks like something that was change in the newer versions, previously it worked ok.

@avioli
Copy link

avioli commented Jun 16, 2018

A silly suggestion - use the old version then.
Latest version that the chart is rendered as "expected" is 2.4.0.

@ghost
Copy link
Author

ghost commented Jun 16, 2018

Right, but that means there's a bug somewhere starting version 2.4.1, shouldn't it be fixed?

@simonbrunel
Copy link
Member

Seems that bug has been introduced in 2.5.0, maybe by #3563 if someone wants to investigate.

@ghost
Copy link
Author

ghost commented Jun 16, 2018

Thanks, does that mean I should continue the conversation there?
I'm less familiar here on how things work with bug fixes...

@simonbrunel
Copy link
Member

simonbrunel commented Jun 16, 2018

Yes, the PR is closed and I doubt anybody will follow up on new comments. This issue needs to be investigated, maintainers are not currently available so PR are more than welcome :)

@ghost
Copy link
Author

ghost commented Jun 16, 2018

By PR you mean referencing to it hoping someone will catch and check it? Thanks a lot!

@simonbrunel
Copy link
Member

I mean any volunteer investigating and fixing this issue, then submitting the code changes via Pull Request.

@dtracers
Copy link

Can't you revert the code that broke it instead if you knew what broke it?

kurkle added a commit to kurkle/Chart.js that referenced this issue Dec 7, 2018
kurkle added a commit to kurkle/Chart.js that referenced this issue Dec 7, 2018
@simonbrunel
Copy link
Member

@amosss @kurkle I'm actually thinking that the current behavior is the expected one because we introduced stack groups at version 2.5.0 and so create distinct stacks (per axis) for every different dataset stack properties. In the given example, there is 2 stacks, 'stack 0' and '' , both on the same x-axis:

  • dataset 0 with stack: "stack 0"
  • dataset 1 with stack: "stack 0"
  • dataset 2 with stack: "" (empty/default)

@amosss if you want the same behavior as 2.4.0, simply remove stack from your dataset while stacked: true in both axes (fiddle 2.7.3).

@simonbrunel
Copy link
Member

Closing this issue per my previous comment.

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

No branches or pull requests

4 participants