Skip to content

Commit

Permalink
fix: New tooltip inappropriately combines series on mixed chart (#30137)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina authored Sep 4, 2024
1 parent 880d634 commit 9cb9e5b
Showing 1 changed file with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
isIntervalAnnotationLayer,
isPhysicalColumn,
isTimeseriesAnnotationLayer,
NumberFormats,
QueryFormData,
QueryFormMetric,
TimeseriesChartDataResponseResult,
Expand Down Expand Up @@ -92,7 +91,6 @@ import {
import { TIMEGRAIN_TO_TIMESTAMP, TIMESERIES_CONSTANTS } from '../constants';
import { getDefaultTooltip } from '../utils/tooltip';
import {
getPercentFormatter,
getTooltipTimeFormatter,
getXAxisFormatter,
getYAxisFormatter,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 9cb9e5b

Please sign in to comment.