diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js index 39b42525af459..c3ef5a972e942 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js @@ -191,19 +191,18 @@ export function generateAreaChartTooltipContent( 'CategoryValue% to total'; d.series.forEach(series => { const key = getFormattedKey(series.key, true); + const isTotal = series.key === 'TOTAL'; let trClass = ''; if (series.highlight) { trClass = 'superset-legacy-chart-nvd3-tr-highlight'; - } else if (series.key === 'TOTAL') { + } else if (isTotal) { trClass = 'superset-legacy-chart-nvd3-tr-total'; } tooltip += `` + - `${ - series.key === 'TOTAL' ? '' : '◼' - }` + + `${isTotal ? '' : '◼'}` + `${key}` + - `${valueFormatter(series?.point?.y)}` + + `${valueFormatter(isTotal ? total : series?.point?.y)}` + `${((100 * series.value) / total).toFixed(2)}%` + ''; });