Merge pull request #699 from geminiwen/fix/dashboard-tooltip-token-sort

fix(dashboard): sort recent usage tooltip labels by token consumption
This commit is contained in:
Wesley Liddick
2026-03-02 08:33:00 +08:00
committed by GitHub

View File

@@ -366,6 +366,11 @@ const lineOptions = computed(() => ({
}
},
tooltip: {
itemSort: (a: any, b: any) => {
const aValue = typeof a?.raw === 'number' ? a.raw : Number(a?.parsed?.y ?? 0)
const bValue = typeof b?.raw === 'number' ? b.raw : Number(b?.parsed?.y ?? 0)
return bValue - aValue
},
callbacks: {
label: (context: any) => {
return `${context.dataset.label}: ${formatTokens(context.raw)}`