chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
64.8k stars 11.92k forks source link

Sort order of stacked scales is inconsistent #9918

Open kurkle opened 2 years ago

kurkle commented 2 years ago

It works. Setting the weight of the left category scale to 2 moves it down. I didn't quite understand the documentation in that point. Also missing is the information in >which order it is sorted.

Originally posted by @pmbert in >https://github.com/chartjs/Chart.js/discussions/9911#discussioncomment-1714252

When stacked, scales are not sorted in a very obvious manner.

genzyy commented 2 years ago

Can I take this up?

alexbodn commented 1 year ago

stackWeight is setting the size of each stack.

trullock commented 11 months ago

Is there a solution/workaround here?

Im trying to have a stacked line, almost exactly like this: https://www.chartjs.org/docs/latest/samples/scales/stacked.html but where the y and y2 scales are replicated on the right. I can't get ON/OFF to appear above the numeric scale.

Incidentally I did manage to make the example on the live-edit url work, but only by editing the code in the right order such that the graph ended up as I wanted. If you try and instantiate the graph clean from scratch with the same code the order is backwards :/

Edit: Ohhhh you have to set weight, as well as stackWeight a la https://github.com/chartjs/Chart.js/discussions/9911#discussioncomment-1714252 Docs on this would be nice :)

Linkens commented 8 months ago

This works but beware, left stack and right stack are inverted for line series, more weight is "down" for left side, and "up" for right side. Really Weird logic, but ok.