Skip to content

Commit

Permalink
fix (v2): filter out zero values and sort tooltip data
Browse files Browse the repository at this point in the history
  • Loading branch information
UmakanthKaspa committed Jan 4, 2025
1 parent 94c0e32 commit 622db31
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion frontend/src/widgets/AxisChart/getAxisChartOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,18 @@ function makeOptions(chartType, labels, datasets, options) {
trigger: 'axis',
confine: true,
appendToBody: false,
valueFormatter: (value) => (isNaN(value) ? value : formatNumber(value)),
formatter: (params) => {
const filteredParams = params
.filter((p) => p.value !== 0 && p.value !== null)
.sort((a, b) => b.value - a.value);

if (!filteredParams.length) return '';
return filteredParams
.map((p) => `${p.marker} ${p.seriesName}: ${formatNumber(p.value)}`)
.join('<br/>');
},
},

}
}

Expand Down

0 comments on commit 622db31

Please sign in to comment.