From 808116d5ddffd9741d39a76db4a00979a7903998 Mon Sep 17 00:00:00 2001 From: Isaac GC Date: Wed, 24 Jan 2024 16:34:07 -0800 Subject: [PATCH] Fixed an accidental divide by 0 edge case --- src/components/Charts/BarChart.vue | 2 +- src/components/Charts/LineChart.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Charts/BarChart.vue b/src/components/Charts/BarChart.vue index 6b94248ce..ff714b396 100644 --- a/src/components/Charts/BarChart.vue +++ b/src/components/Charts/BarChart.vue @@ -196,7 +196,7 @@ export default { this.padding + this.left + (i * (this.viewBoxWidth - this.left - 2 * this.padding)) / - (this.count - 1) + (this.count - 1 || 1) // The "or" one (1) prevents accidentally dividing by 0 ); }, z() { diff --git a/src/components/Charts/LineChart.vue b/src/components/Charts/LineChart.vue index 35fc12ccc..2a79f65c5 100644 --- a/src/components/Charts/LineChart.vue +++ b/src/components/Charts/LineChart.vue @@ -193,7 +193,7 @@ export default { this.padding + this.left + (i * (this.viewBoxWidth - this.left - 2 * this.padding)) / - (this.count - 1) + (this.count - 1 || 1) // The "or" one (1) prevents accidentally dividing by 0 ); }, ys() {