mirror of
https://github.com/apache/superset.git
synced 2024-09-06 13:57:40 -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>';
|
||||
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>';
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user