mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
handle percentage case for tooltips (#2570)
This commit is contained in:
parent
412634cb57
commit
ab0bc5a3fa
@ -211,6 +211,13 @@ function nvd3Vis(slice, payload) {
|
||||
chart.labelThreshold(0.05) // Configure the minimum slice size for labels to show up
|
||||
.labelType(fd.pie_label_type);
|
||||
chart.cornerRadius(true);
|
||||
|
||||
if (fd.pie_label_type === 'percent') {
|
||||
let total = 0;
|
||||
payload.data.forEach((d) => { total += d.y; });
|
||||
chart.tooltip.valueFormatter(d => `${((d / total) * 100).toFixed()}%`);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'column':
|
||||
|
Loading…
Reference in New Issue
Block a user