Add zoom and pan

This commit is contained in:
Edward Betts 2023-12-22 19:56:27 +00:00
parent 4bae8bc64a
commit e29c5899aa

View file

@ -5,6 +5,8 @@
<title>Open bugs over time</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.min.js"></script>
</head>
<body>
@ -31,7 +33,20 @@ document.addEventListener('DOMContentLoaded', function () {
data: data
}]
},
options: {
plugins: {
zoom: {
pan: {
enabled: true,
},
zoom: {
wheel: { enabled: true },
pinch: { enabled: true },
mode: 'xy',
}
}
},
scales: {
x: {
type: 'time',