Skip to content

Commit 9c559f4

Browse files
committed
fix: always round tooltip values
1 parent fbe522a commit 9c559f4

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

app/components/Package/TrendsChart.vue

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ function setIsZoom({ isZoom }: { isZoom: boolean }) {
7474
const { width } = useElementSize(rootEl)
7575
7676
const compactNumberFormatter = useCompactNumberFormatter()
77-
const integerFormatter = useNumberFormatter({
78-
maximumFractionDigits: 0,
79-
})
8077
8178
onMounted(async () => {
8279
rootEl.value = document.documentElement
@@ -1543,11 +1540,8 @@ const chartConfig = computed<VueUiXyConfig>(() => {
15431540
const rows = items
15441541
.map((d: Record<string, any>) => {
15451542
const label = String(d?.name ?? '').trim()
1546-
const raw = Number(d?.value ?? 0)
1547-
const v =
1548-
raw > 1_000
1549-
? compactNumberFormatter.value.format(Number.isFinite(raw) ? raw : 0)
1550-
: integerFormatter.value.format(Number.isFinite(raw) ? raw : 0)
1543+
const raw = Math.round(Number(d?.value ?? 0))
1544+
const v = compactNumberFormatter.value.format(Number.isFinite(raw) ? raw : 0)
15511545
15521546
if (!hasMultipleItems) {
15531547
// We don't need the name of the package in this case, since it is shown in the xAxis label
@@ -2000,7 +1994,7 @@ const isSparklineLayout = computed({
20001994

20011995
<!-- Custom legend for multiple series -->
20021996
<template #legend="{ legend }">
2003-
<div class="flex gap-x-6 gap-y-2 flex-wrap justify-center text-sm">
1997+
<div class="flex gap-4 flex-wrap justify-center">
20041998
<template v-if="isMultiPackageMode">
20051999
<button
20062000
v-for="datapoint in legend"
@@ -2206,13 +2200,13 @@ const isSparklineLayout = computed({
22062200

22072201
<style scoped>
22082202
:deep(.vue-data-ui-component svg:focus-visible) {
2209-
outline: 1px solid var(--accent) !important;
2203+
outline: 1px solid var(--accent-color) !important;
22102204
border-radius: 0.1rem;
22112205
outline-offset: 0;
22122206
}
22132207
:deep(.vue-ui-user-options-button:focus-visible),
22142208
:deep(.vue-ui-user-options :first-child:focus-visible) {
2215-
outline: 0.1rem solid var(--accent) !important;
2209+
outline: 0.1rem solid var(--accent-color) !important;
22162210
border-radius: 0.25rem;
22172211
}
22182212
</style>

0 commit comments

Comments
 (0)