Skip to content

Commit 0793716

Browse files
committed
Fix - VueUiGauge - Fixed harmless console error related to path painted before data is computed
1 parent 3537497 commit 0793716

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/vue-ui-gauge.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ const pointyPointerPath = computed(() => {
131131
const baseY1 = centerY + baseLength * Math.sin(angle + (Math.PI / 2));
132132
const baseX2 = centerX + baseLength * Math.cos(angle - (Math.PI / 2));
133133
const baseY2 = centerY + baseLength * Math.sin(angle - (Math.PI / 2));
134+
135+
if(isNaN(tipX)) return null;
136+
134137
return `M ${tipX},${tipY} ${baseX1},${baseY1} ${baseX2},${baseY2} Z`;
135138
})
136139
@@ -575,6 +578,7 @@ defineExpose({
575578
</g>
576579
<g v-else>
577580
<path
581+
v-if="pointyPointerPath"
578582
:d="pointyPointerPath"
579583
:fill="gaugeConfig.style.chart.layout.pointer.useRatingColor ? ratingColor : gaugeConfig.style.chart.layout.pointer.color"
580584
:stroke="gaugeConfig.style.chart.layout.pointer.stroke"

0 commit comments

Comments
 (0)