Skip to content

Commit 2872d84

Browse files
committed
fix: prevent chart legend text wrapping in png prints
1 parent d606958 commit 2872d84

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

app/components/Package/TrendsChart.vue

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,23 +1758,25 @@ const copyEmbedUrl = () => copyEmbed(embedUrl.value)
17581758

17591759
<!-- Custom legend for multiple series -->
17601760
<template #legend="{ legend }">
1761-
<div class="flex gap-x-6 gap-y-2 flex-wrap justify-center text-sm">
1761+
<div class="flex flex-wrap justify-center gap-x-6 gap-y-2 text-sm">
17621762
<template v-if="isMultiPackageMode">
17631763
<button
17641764
v-for="datapoint in legend"
17651765
:key="datapoint.name"
17661766
:aria-pressed="datapoint.isSegregated"
17671767
:aria-label="datapoint.name"
17681768
type="button"
1769-
class="flex gap-1 place-items-center"
1769+
class="flex shrink-0 items-center gap-1 whitespace-nowrap"
17701770
@click="datapoint.segregate()"
17711771
>
1772-
<div class="h-3 w-3">
1772+
<div class="h-3 w-3 shrink-0">
17731773
<svg viewBox="0 0 2 2" class="w-full">
17741774
<rect x="0" y="0" width="2" height="2" rx="0.3" :fill="datapoint.color" />
17751775
</svg>
17761776
</div>
1777+
17771778
<span
1779+
class="shrink-0 whitespace-nowrap"
17781780
:style="{
17791781
textDecoration: datapoint.isSegregated ? 'line-through' : undefined,
17801782
}"
@@ -1786,24 +1788,24 @@ const copyEmbedUrl = () => copyEmbed(embedUrl.value)
17861788

17871789
<!-- Single series legend (no user interaction) -->
17881790
<template v-else-if="legend.length > 0">
1789-
<div class="flex gap-1 place-items-center">
1790-
<div class="h-3 w-3">
1791+
<div class="flex shrink-0 items-center gap-1 whitespace-nowrap">
1792+
<div class="h-3 w-3 shrink-0">
17911793
<svg viewBox="0 0 2 2" class="w-full">
17921794
<rect x="0" y="0" width="2" height="2" rx="0.3" :fill="legend[0]?.color" />
17931795
</svg>
17941796
</div>
1795-
<span>
1797+
<span class="shrink-0 whitespace-nowrap">
17961798
{{ legend[0]?.name }}
17971799
</span>
17981800
</div>
17991801
</template>
18001802

18011803
<!-- Estimation extra legend item -->
18021804
<div
1803-
class="flex gap-1 place-items-center"
1805+
class="flex shrink-0 items-center gap-1 whitespace-nowrap"
18041806
v-if="supportsEstimation || hasDownloadAnomalies"
18051807
>
1806-
<svg viewBox="0 0 20 2" width="20">
1808+
<svg viewBox="0 0 20 2" width="20" class="shrink-0">
18071809
<line
18081810
x1="0"
18091811
y1="1"
@@ -1814,7 +1816,9 @@ const copyEmbedUrl = () => copyEmbed(embedUrl.value)
18141816
stroke-linecap="round"
18151817
/>
18161818
</svg>
1817-
<span class="text-fg-subtle">{{ $t('package.trends.legend_estimation') }}</span>
1819+
<span class="shrink-0 whitespace-nowrap text-fg-subtle">
1820+
{{ $t('package.trends.legend_estimation') }}
1821+
</span>
18181822
</div>
18191823
</div>
18201824
</template>

app/components/Package/VersionDistribution.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,13 +506,13 @@ const chartConfig = computed<VueUiXyConfig>(() => {
506506
<template #legend="{ legend }">
507507
<div class="flex gap-4 flex-wrap justify-center pt-8">
508508
<template v-if="legend.length > 0">
509-
<div class="flex gap-1 place-items-center">
510-
<div class="h-3 w-3">
509+
<div class="flex gap-1 shrink-0 items-center whitespace-nowrap">
510+
<div class="h-3 w-3 shrink-0">
511511
<svg viewBox="0 0 2 2" class="w-full">
512512
<rect x="0" y="0" width="2" height="2" rx="0.3" :fill="legend[0]?.color" />
513513
</svg>
514514
</div>
515-
<span>
515+
<span class="shrink-0 whitespace-nowrap">
516516
{{ legend[0]?.name }}
517517
</span>
518518
</div>

0 commit comments

Comments
 (0)