From 584a5f591ef0fe9d4f5d9393204c8568e981a8a7 Mon Sep 17 00:00:00 2001 From: Kenzo-Hugo Hillion <kenzo-hugo.hillion1@pasteur.fr> Date: Wed, 4 Dec 2019 11:38:42 +0100 Subject: [PATCH] clean code --- frontend/src/components/Doughnut.vue | 30 +++++++++++++-------------- frontend/src/components/Histogram.vue | 18 ++++++++-------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/frontend/src/components/Doughnut.vue b/frontend/src/components/Doughnut.vue index a34b652..3ee2973 100644 --- a/frontend/src/components/Doughnut.vue +++ b/frontend/src/components/Doughnut.vue @@ -58,21 +58,6 @@ export default { noGraph: true, } }, - watch: { - doughnutData(val) { - if (this.noGraph) { - this.noGraph = false; - this.createChart(); - } - this.updateChart(); - }, - hideLegend(val) { - this.updateChartOptions(); - }, - hideLabels() { - this.updateChartData(); - } - }, computed: { hideLabelsLabel() { if (Object.entries(this.doughnutData).length == 0) { @@ -138,5 +123,20 @@ export default { this.myChart.update(); }, }, + watch: { + doughnutData(val) { + if (this.noGraph) { + this.noGraph = false; + this.createChart(); + } + this.updateChart(); + }, + hideLegend(val) { + this.updateChartOptions(); + }, + hideLabels() { + this.updateChartData(); + } + }, }; </script> diff --git a/frontend/src/components/Histogram.vue b/frontend/src/components/Histogram.vue index a367a41..6de0507 100644 --- a/frontend/src/components/Histogram.vue +++ b/frontend/src/components/Histogram.vue @@ -32,15 +32,6 @@ export default { noGraph: true, } }, - watch: { - histoData(val) { - if (this.noGraph) { - this.noGraph = false; - this.createChart(); - } - this.updateChart(); - }, - }, methods: { createChart() { const ctx = document.getElementById(this.chartId); @@ -66,5 +57,14 @@ export default { this.myChart.update(); }, }, + watch: { + histoData(val) { + if (this.noGraph) { + this.noGraph = false; + this.createChart(); + } + this.updateChart(); + }, + }, }; </script> -- GitLab