Skip to content

Commit af826bb

Browse files
style(图表): 桑基图提示占比的显示优化
1 parent d868fdf commit af826bb

File tree

1 file changed

+4
-5
lines changed
  • core/core-frontend/src/views/chart/components/js/panel/charts/others

1 file changed

+4
-5
lines changed

core/core-frontend/src/views/chart/components/js/panel/charts/others/sankey.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,11 @@ export class SankeyBar extends G2PlotChartView<SankeyOptions, Sankey> {
195195
const { source, target, value } = datum
196196
// 总出占比
197197
if (t.tooltipFormatter.showTotalPercent) {
198-
const decimalCount =
199-
t.tooltipFormatter.type !== 'auto' ? t.tooltipFormatter.decimalCount : 2
200-
const ratio = (value / outTotal[source]).toFixed(decimalCount)
198+
const { decimalCount = 2 } = t.tooltipFormatter
199+
const ratioStr = ((value / outTotal[source]) * 100).toFixed(decimalCount) + '%'
201200
return {
202-
name: source + ' -> ' + target,
203-
value: valueFormatter(value, t.tooltipFormatter) + ` (${ratio}%)`
201+
name: `${source} -> ${target}`,
202+
value: valueFormatter(value, t.tooltipFormatter) + ` (${ratioStr})`
204203
}
205204
}
206205
return {

0 commit comments

Comments
 (0)