Open
Description
See the onZoomComplete function. When the message is shown in console, the zoom range still has valid data, but the chart is empty.
I am using version '"chartjs-plugin-zoom": "^2.0.1",'
My zoom config is:
zoom: {
zoom: {
mode: 'xy',
drag: {
enabled: true,
},
pinch: {
enabled: true,
},
scaleMode: 'xy',
onZoomComplete: (context) => {
const chart = context.chart;
const xScale = chart.scales.x;
if (xScale.max < xScale.min) {
console.log(xScale);
}
chart.update();
},
},
}
The console output is (min 969, max 257):
active: false
axis: "x"
bottom: 802.8
chart: Object { id: 4, width: 1012, height: 805, … }
ctx: CanvasRenderingContext2D { globalAlpha: 1, globalCompositeOperation: "source-over", strokeStyle: "#000000", … }
fullSize: false
height: 8
id: "x"
labelRotation: 0
left: 44
max: 257
maxHeight: 402.5
maxWidth: 967.25
min: 969
options: Proxy { <target>: {…}, <handler>: {…} }
paddingBottom: 0
paddingLeft: 0
paddingRight: 0
paddingTop: 0
position: "bottom"
right: 1011.25
ticks: Array []
top: 794.8
type: "category"
weight: 0
width: 967.25
x: undefined
y: undefined