From 34308fea61f9d0c4b44f50ee73c6072e59475283 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" Date: Tue, 8 Aug 2023 11:42:55 -0300 Subject: [PATCH] fix: Tooltip of area chart shows undefined total --- .../plugins/legacy-preset-chart-nvd3/src/utils.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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)}%` + ''; });