Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Sort order of stacked scales is inconsistent

Open kurkle opened this issue 3 years ago • 3 comments

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.

kurkle avatar Nov 29 '21 10:11 kurkle

Can I take this up?

rishitxyz avatar Dec 06 '21 11:12 rishitxyz

stackWeight is setting the size of each stack.

alexbodn avatar Jul 16 '23 18:07 alexbodn

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 :)

trullock avatar Dec 05 '23 20:12 trullock

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.

Linkens avatar Mar 15 '24 19:03 Linkens