Closed joshkel closed 2 years ago
@joshkel this is intended but, as you have correctly highlighted, the migration guide is not reporting this breaking change. I apologize.
In 2.x, position:
'start'
means the bottom of the line, and position:'end'
means the top of the line.
In version 2, start means where the line starts drawing, end where the line ends. It's not longer related to chart area (top, left, bottom, right
) but to the values sequence on the related scale.
When a line is defined using x/yMin and x/yMax, it sounds to me correct that the start is the point {x: xMin, y: yMin}
and the end is {x: xMax, y: yMax}
.
For instance, in the codepen, the start of line is xMin: 1
and yMin: 0
(before is missing and is the lowest value of the scale but on the bottom of chart area) and the end of line is xMax: 1
and yMin: 10
(before is missing and is the highest value of the scale but on the top of chart area). This implementation is managing the scale.reverse
option as well.
I will submit a PR to change migration guide soon.
@stockiNail Makes sense. Thanks for the explanation and the quick reply.
I'm not sure if this is intended as a breaking change (although I don't see it in the migration guide) or if it's a bug, but the interpretation of the
position
property for a vertical line has changed in chartjs-plugin-annotation 2.0.0.In 1.x,
position: 'start'
meant the top of the line, andposition: 'end'
meant the bottom of the line. (This feels more intuitive to me.)In 2.x,
position: 'start' means the bottom of the line, and
position: 'start'` means the top of the line.Demo: https://codesandbox.io/s/chartjs-annotation-label-position-th2kcr?file=/src/index.js (You can change the version of the plugin in the "Dependencies" section in the left sidebar to demonstrate.)