This is an automated email from the ASF dual-hosted git repository. michaelsmolina pushed a commit to branch 3.0 in repository https://gitbox.apache.org/repos/asf/superset.git
commit df92cc2d55ddbaf078f4c0baa8475781f5600cd6 Author: Michael S. Molina <[email protected]> AuthorDate: Tue Aug 8 18:13:21 2023 -0300 fix: Tooltip of area chart shows undefined total (#24916) (cherry picked from commit ec9e9a46f2f092ce56d3ed5a8a9a3ea0214db88a) --- superset-frontend/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 39b42525af..c3ef5a972e 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( '<tr class="tooltip-header"><td></td><td>Category</td><td>Value</td><td>% to total</td></tr>'; 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 += `<tr class="${trClass}" style="border-color: ${series.color}">` + - `<td style="color: ${series.color}">${ - series.key === 'TOTAL' ? '' : '◼' - }</td>` + + `<td style="color: ${series.color}">${isTotal ? '' : '◼'}</td>` + `<td>${key}</td>` + - `<td>${valueFormatter(series?.point?.y)}</td>` + + `<td>${valueFormatter(isTotal ? total : series?.point?.y)}</td>` + `<td>${((100 * series.value) / total).toFixed(2)}%</td>` + '</tr>'; });
