Ден*_*чер 5 javascript chart.js chartjs-plugin-zoom
我有一个使用 ChartJS 和用于缩放的插件“chart-plugin-zoom”绘制的图形。我需要将 y 轴自动缩放到可见图形段上显示的数据点,同时在 x 轴上进行缩放。我该怎么做?
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,
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
325 次 |
| 最近记录: |