fix: New tooltip inappropriately combines series on mixed chart (#30137)

This commit is contained in:
Michael S. Molina 2024-09-04 08:38:43 -03:00 committed by GitHub
parent 880d634dc8
commit 9cb9e5beee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 24 deletions

View File

@ -35,7 +35,6 @@ import {
isIntervalAnnotationLayer,
isPhysicalColumn,
isTimeseriesAnnotationLayer,
NumberFormats,
QueryFormData,
QueryFormMetric,
TimeseriesChartDataResponseResult,
@ -92,7 +91,6 @@ import {
import { TIMEGRAIN_TO_TIMESTAMP, TIMESERIES_CONSTANTS } from '../constants';
import { getDefaultTooltip } from '../utils/tooltip';
import {
getPercentFormatter,
getTooltipTimeFormatter,
getXAxisFormatter,
getYAxisFormatter,
@ -235,7 +233,6 @@ export default function transformProps(
const xAxisDataType = dataTypes?.[xAxisLabel] ?? dataTypes?.[xAxisOrig];
const xAxisType = getAxisType(stack, xAxisForceCategorical, xAxisDataType);
const series: SeriesOption[] = [];
const percentFormatter = getPercentFormatter(NumberFormats.PERCENT_2_POINT);
const formatter = contributionMode
? getNumberFormatter(',.0%')
: currencyFormat?.symbol
@ -592,17 +589,6 @@ export default function transformProps(
const forecastValues =
extractForecastValuesFromTooltipParams(forecastValue);
const isForecast = Object.values(forecastValues).some(
value =>
value.forecastTrend || value.forecastLower || value.forecastUpper,
);
const total = Object.values(forecastValues).reduce(
(acc, value) =>
value.observation !== undefined ? acc + value.observation : acc,
0,
);
const showTotal = richTooltip && !isForecast;
const keys = Object.keys(forecastValues);
keys.forEach(key => {
const value = forecastValues[key];
@ -637,18 +623,8 @@ export default function transformProps(
? tooltipFormatter
: tooltipFormatterSecondary,
});
if (showTotal && value.observation !== undefined) {
row.push(percentFormatter.format(value.observation / (total || 1)));
}
rows.push(row);
});
if (showTotal) {
rows.push([
'Total',
formatter.format(total),
percentFormatter.format(1),
]);
}
return tooltipHtml(
rows,
tooltipFormatter(xValue),