Skip to content

Commit a4a81da

Browse files
committed
Fix harmless svg console errors while the chart is still computing
1 parent b539edd commit a4a81da

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/components/vue-ui-sparkline.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,12 @@ const mutableDataset = computed(() => {
297297
});
298298
299299
const area = computed(() => {
300-
const start = { x: mutableDataset.value[0].x, y: svg.value.height - 6 };
301-
const end = { x: mutableDataset.value[mutableDataset.value.length -1].x, y: svg.value.height - 6 };
300+
const start = { x: mutableDataset.value[0].x || 0, y: (svg.value.height || 0) - 6 };
301+
const end = { x: mutableDataset.value[mutableDataset.value.length -1].x || 0, y: (svg.value.height || 0) - 6 };
302302
const path = [];
303303
mutableDataset.value.forEach(v => {
304-
path.push(`${v.x},${v.y} `)
304+
path.push(`${v.x || 0},${v.y || 0} `)
305305
});
306-
307306
return [ start.x,start.y, ...path, end.x, end.y ].toString();
308307
});
309308
@@ -455,8 +454,8 @@ function selectDatapoint(datapoint, index) {
455454
:data-cy="`sparkline-segment-${i}`"
456455
:x1="plot.x"
457456
:x2="mutableDataset[i + 1].x"
458-
:y1="plot.y"
459-
:y2="mutableDataset[i + 1].y"
457+
:y1="plot.y || 0"
458+
:y2="mutableDataset[i + 1].y || 0"
460459
:stroke="plot.color"
461460
:stroke-width="FINAL_CONFIG.style.line.strokeWidth"
462461
stroke-linecap="round"

src/components/vue-ui-stackbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ defineExpose({
10101010
v-for="(rect, j) in dp.x"
10111011
:x="rect"
10121012
:y="dp.y[j] < 0 ? 0 : dp.y[j]"
1013-
:height="dp.height[j] < 0 ? 0.0001 : dp.height[j]"
1013+
:height="dp.height[j] < 0 ? 0.0001 : dp.height[j] || 0"
10141014
:rx="FINAL_CONFIG.style.chart.bars.borderRadius > dp.height[j] / 2 ? (dp.height[j] < 0 ? 0 : dp.height[j]) / 2 : FINAL_CONFIG.style.chart.bars.borderRadius "
10151015
:width="barSlot * (1 - FINAL_CONFIG.style.chart.bars.gapRatio / 2)"
10161016
:fill="FINAL_CONFIG.style.chart.bars.gradient.show ? `url(#gradient_${dp.id})` : dp.color"

0 commit comments

Comments
 (0)