Skip to content

Commit 379630a

Browse files
committed
fix: enable tooltip
1 parent df47c0b commit 379630a

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

app/components/Compare/FacetBarChart.vue

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<script setup lang="ts">
22
import { ref, computed } from 'vue'
33
import { VueUiHorizontalBar } from 'vue-data-ui/vue-ui-horizontal-bar'
4-
import type { VueUiHorizontalBarConfig, VueUiHorizontalBarDatasetItem } from 'vue-data-ui'
4+
import type {
5+
VueUiHorizontalBarConfig,
6+
VueUiHorizontalBarDatapoint,
7+
VueUiHorizontalBarDatasetItem,
8+
} from 'vue-data-ui'
59
import { getFrameworkColor, isListedFramework } from '~/utils/frameworks'
610
import { drawSmallNpmxLogoAndTaglineWatermark } from '~/composables/useChartWatermark'
711
import {
@@ -190,7 +194,7 @@ const config = computed<VueUiHorizontalBarConfig>(() => {
190194
},
191195
underlayerColor: colors.value.bg,
192196
},
193-
highlighter: { opacity: 0 },
197+
highlighter: { opacity: 5 },
194198
},
195199
legend: {
196200
show: false,
@@ -206,7 +210,25 @@ const config = computed<VueUiHorizontalBarConfig>(() => {
206210
color: colors.value.fgSubtle,
207211
},
208212
},
209-
tooltip: { show: false },
213+
tooltip: {
214+
borderColor: 'transparent',
215+
backdropFilter: false,
216+
backgroundColor: 'transparent',
217+
customFormat: ({ datapoint }) => {
218+
return `
219+
<div class="font-mono p-3 border border-border rounded-md bg-[var(--bg)]/10 backdrop-blur-md">
220+
<div class="flex items-center gap-2">
221+
<div class="w-3 h-3">
222+
<svg viewBox="0 0 2 2" class="w-full h-full">
223+
<rect x="0" y="0" width="2" height="2" rx="0.3" fill="${datapoint?.color}" />
224+
</svg>
225+
</div>
226+
<span>${datapoint?.name}: ${(datapoint as VueUiHorizontalBarDatapoint).formattedValue}</span>
227+
</div>
228+
</div>
229+
`
230+
},
231+
},
210232
},
211233
},
212234
}

0 commit comments

Comments
 (0)