Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/components/Chart/SplitSparkline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ const props = defineProps<{

const { locale } = useI18n()
const colorMode = useColorMode()
const numberFormatter = useNumberFormatter({
maximumFractionDigits: 0,
})
const numberFormatter = useNumberFormatter()
const resolvedMode = shallowRef<'light' | 'dark'>('light')
const rootEl = shallowRef<HTMLElement | null>(null)
const palette = getPalette('')
Expand Down
2 changes: 1 addition & 1 deletion app/components/Package/TrendsChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ const chartConfig = computed<VueUiXyConfig>(() => {
const rows = items
.map((d: Record<string, any>) => {
const label = String(d?.name ?? '').trim()
const raw = Math.round(Number(d?.value ?? 0))
const raw = Number(d?.value ?? 0)
const v = compactNumberFormatter.value.format(Number.isFinite(raw) ? raw : 0)

if (!hasMultipleItems) {
Expand Down
4 changes: 1 addition & 3 deletions app/components/Package/WeeklyDownloadStats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ function handleModalTransitioned() {
}
const { fetchPackageDownloadEvolution } = useCharts()
const numberFormatter = useNumberFormatter({
maximumFractionDigits: 0,
})
const numberFormatter = useNumberFormatter()
const { accentColors, selectedAccentColor } = useAccentColor()
Expand Down
3 changes: 2 additions & 1 deletion app/utils/chart-data-correction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface ChartFilterSettings {
}

/**
* Applies moving average then smoothing in sequence.
* Applies moving average, smoothing and then rounding up in sequence.
*/
export function applyDataCorrection<T extends { value: number }>(
data: T[],
Expand All @@ -92,5 +92,6 @@ export function applyDataCorrection<T extends { value: number }>(
let result = data
result = movingAverage(result, settings.averageWindow)
result = smoothing(result, settings.smoothingTau)
result = result.map(d => ({ ...d, value: Math.ceil(d.value) }))
return result
}
Loading