I have a graph plotting with ChartJS and plugin 'chart-plugin-zoom' for zooming. I need to auto-scale y-axis to data points shown on visible graph segment while zoom on x-axis. How I can do it?
zoom: {
enabled: true,
mode: chart.options['maxValue'] && chart.options['maxValue'] !== 0 ? 'xy' : 'x',
rangeMin: {
x: 60000, // Limit zoom in range: 1 min
y: chart.options['series'][index] && chart.options['series'][index].beginAtZero ? 0 : null
},
rangeMax: {
x: chart.options['maxX'] - chart.options['minX'],
y: chart.options['maxValue'] && chart.options['maxValue'] !== 0 ? 1.2 * chart.options['maxValue'] : null,
}
}