diff --git a/src/components/Discover/Map/Filter/AttributesFilter.vue b/src/components/Discover/Map/Filter/AttributesFilter.vue index f47ae26..3290f8e 100644 --- a/src/components/Discover/Map/Filter/AttributesFilter.vue +++ b/src/components/Discover/Map/Filter/AttributesFilter.vue @@ -650,6 +650,7 @@ function getPercentLabel(val) { * @param {object} chart - The Chart.js instance data. */ function resizeMask(chart) { + if (selectRange.value === 0) return; const from = (selectArea.value[0] * 0.01) / (selectRange.value * 0.01); const to = (selectArea.value[1] * 0.01) / (selectRange.value * 0.01); resizeLeftMask(chart, from); @@ -663,6 +664,7 @@ function resizeMask(chart) { function resizeLeftMask(chart, from) { const canvas = document.querySelector("#chartCanvasId canvas"); const mask = document.getElementById("chart-mask-left"); + if (!canvas || !mask) return; mask.style.left = `${canvas.offsetLeft + chart.chartArea.left}px`; mask.style.width = `${chart.chartArea.width * from}px`; mask.style.top = `${canvas.offsetTop + chart.chartArea.top}px`; @@ -676,6 +678,7 @@ function resizeLeftMask(chart, from) { function resizeRightMask(chart, to) { const canvas = document.querySelector("#chartCanvasId canvas"); const mask = document.getElementById("chart-mask-right"); + if (!canvas || !mask) return; mask.style.left = `${canvas.offsetLeft + chart.chartArea.left + chart.chartArea.width * to}px`; mask.style.width = `${chart.chartArea.width * (1 - to)}px`; mask.style.top = `${canvas.offsetTop + chart.chartArea.top}px`;