11<script setup lang="ts">
22import { ref , computed } from ' vue'
33import { 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'
59import { getFrameworkColor , isListedFramework } from ' ~/utils/frameworks'
610import { drawSmallNpmxLogoAndTaglineWatermark } from ' ~/composables/useChartWatermark'
711import {
@@ -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