Chart.js
Chart.js copied to clipboard
Sort order of stacked scales is inconsistent
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.
- Left scales are sorted top to bottom.
- Top scales right to left.
- Right scales are sorted bottom to top.
- Bottom scales are sorted left to right.
Can I take this up?
stackWeight is setting the size of each stack.
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 :)
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.