Skip to content

Commit 595c51c

Browse files
committed
fix: compare scatter chart scale labels overlapping on first load
1 parent 8b57e4e commit 595c51c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

app/components/Compare/FacetScatterChart.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import('vue-data-ui/style.css')
1111
const props = defineProps<{
1212
packagesData: ReadonlyArray<PackageComparisonData | null>
1313
packages: string[]
14+
isActiveTab: boolean
1415
}>()
1516
1617
const colorMode = useColorMode()
@@ -288,6 +289,17 @@ onMounted(async () => {
288289
await nextTick()
289290
readyTeleport.value = true
290291
})
292+
293+
// When he tab contents are hidden through v-show on load, the chart is mounted, but its internal autosizing feature trigger on an empty size, which leads to overlapping between scale labels and axis label on Y. This triggers a re-render of the chart when the tab is active.
294+
watch(
295+
() => props.isActiveTab,
296+
isActive => {
297+
if (isActive) {
298+
step.value += 1
299+
}
300+
},
301+
{ flush: 'post' },
302+
)
291303
</script>
292304

293305
<template>

app/pages/compare.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ useSeoMeta({
455455
v-if="packages.length"
456456
:packages-data="packagesData"
457457
:packages="packages.filter(p => p !== NO_DEPENDENCY_ID)"
458+
:is-active-tab="comparisonView === 'charts'"
458459
/>
459460
</div>
460461
</TabPanel>

0 commit comments

Comments
 (0)