mirror of
https://github.com/apache/superset.git
synced 2024-09-16 02:29:39 -04:00
fix: Tooltip of area chart shows undefined total (#24916)
This commit is contained in:
parent
81bf2f01e2
commit
ec9e9a46f2
@ -191,19 +191,18 @@ export function generateAreaChartTooltipContent(
|
|||||||
'<tr class="tooltip-header"><td></td><td>Category</td><td>Value</td><td>% to total</td></tr>';
|
'<tr class="tooltip-header"><td></td><td>Category</td><td>Value</td><td>% to total</td></tr>';
|
||||||
d.series.forEach(series => {
|
d.series.forEach(series => {
|
||||||
const key = getFormattedKey(series.key, true);
|
const key = getFormattedKey(series.key, true);
|
||||||
|
const isTotal = series.key === 'TOTAL';
|
||||||
let trClass = '';
|
let trClass = '';
|
||||||
if (series.highlight) {
|
if (series.highlight) {
|
||||||
trClass = 'superset-legacy-chart-nvd3-tr-highlight';
|
trClass = 'superset-legacy-chart-nvd3-tr-highlight';
|
||||||
} else if (series.key === 'TOTAL') {
|
} else if (isTotal) {
|
||||||
trClass = 'superset-legacy-chart-nvd3-tr-total';
|
trClass = 'superset-legacy-chart-nvd3-tr-total';
|
||||||
}
|
}
|
||||||
tooltip +=
|
tooltip +=
|
||||||
`<tr class="${trClass}" style="border-color: ${series.color}">` +
|
`<tr class="${trClass}" style="border-color: ${series.color}">` +
|
||||||
`<td style="color: ${series.color}">${
|
`<td style="color: ${series.color}">${isTotal ? '' : '◼'}</td>` +
|
||||||
series.key === 'TOTAL' ? '' : '◼'
|
|
||||||
}</td>` +
|
|
||||||
`<td>${key}</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>` +
|
`<td>${((100 * series.value) / total).toFixed(2)}%</td>` +
|
||||||
'</tr>';
|
'</tr>';
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user