Skip to content

Commit

Permalink
zoom plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksalici committed Aug 23, 2023
1 parent 320ad04 commit 836d039
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 7 deletions.
45 changes: 39 additions & 6 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"dependencies": {
"chart.js": "^4.3.0",
"chartjs-plugin-zoom": "^2.0.1",
"js-cookie": "^3.0.3",
"moment": "^2.29.4",
"vue": "^3.2.31",
Expand Down
21 changes: 20 additions & 1 deletion frontend/src/components/Stat.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script setup>
import { Line } from "vue-chartjs";
import zoomPlugin from 'chartjs-plugin-zoom';
import moment from "moment";
import {ref, watchEffect} from 'vue';
import {
Chart as ChartJS,
Title,
Expand All @@ -22,7 +24,8 @@ ChartJS.register(
LineElement,
CategoryScale,
LinearScale,
Colors
Colors,
zoomPlugin
);
const props = defineProps({
Expand Down Expand Up @@ -74,6 +77,22 @@ const chartOptions = {
enabled: true,
position: 'nearest',
},
zoom: {
zoom: {
wheel: {
enabled: true,
modifierKey: 'ctrl',
},
pinch: {
enabled: true
},
mode: 'xy',
},
limits:{
x: {min: 0, max: 'original'},
y: {min: 0, max: 'original'}
}
}
},
};
Expand Down

0 comments on commit 836d039

Please sign in to comment.