plotly.js
plotly.js copied to clipboard
Shapes are drawn outside the plot when using annotations and autorange.
When updating shapes and annotations with Plotly.react, both are drawn outside the plot when the y-axis is automatically ranged. StackBlitz Example
This seems to be because the y range is reset to [0, 4], the data hasn't changed so the range isn't re-calculated, and the annotations draw procedure updates the y-axis _m and _b metrics used to calculate the paths (src/components/annotations/draw.js line 71). I can't pass the current range, because the axis range should be re-calculated if the data does change. This only occurs if the annotations are updated, because the shapes draw procedure doesn't update the y-axis metrics.
Plotly.js 1.54.6