You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2023/08/08 21:13:28 UTC
[superset] branch master updated: fix: Tooltip of area chart shows undefined total (#24916)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new ec9e9a46f2 fix: Tooltip of area chart shows undefined total (#24916)
ec9e9a46f2 is described below
commit ec9e9a46f2f092ce56d3ed5a8a9a3ea0214db88a
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Tue Aug 8 18:13:21 2023 -0300
fix: Tooltip of area chart shows undefined total (#24916)
---
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>';
});