Skip to content

Commit

Permalink
fix: Tooltip of area chart shows undefined total (#24916)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina authored Aug 8, 2023
1 parent 81bf2f0 commit ec9e9a4
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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' ? '' : '&#9724;'
}</td>` +
`<td style="color: ${series.color}">${isTotal ? '' : '&#9724;'}</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>';
});
Expand Down

0 comments on commit ec9e9a4

Please sign in to comment.