mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
fix: Total calculation in stacked Timeseries charts (#24477)
This commit is contained in:
committed by
GitHub
parent
51a34d7d58
commit
c5b4ecdca5
@@ -27,6 +27,7 @@ import {
|
||||
getTimeFormatter,
|
||||
IntervalAnnotationLayer,
|
||||
isTimeseriesAnnotationResult,
|
||||
LegendState,
|
||||
NumberFormatter,
|
||||
smartDateDetailedFormatter,
|
||||
smartDateFormatter,
|
||||
@@ -65,7 +66,7 @@ import {
|
||||
formatAnnotationLabel,
|
||||
parseAnnotationOpacity,
|
||||
} from '../utils/annotation';
|
||||
import { currentSeries, getChartPadding } from '../utils/series';
|
||||
import { getChartPadding } from '../utils/series';
|
||||
import {
|
||||
OpacityEnum,
|
||||
StackControlsValue,
|
||||
@@ -156,6 +157,7 @@ export function transformSeries(
|
||||
yAxisIndex?: number;
|
||||
showValue?: boolean;
|
||||
onlyTotal?: boolean;
|
||||
legendState?: LegendState;
|
||||
formatter?: NumberFormatter;
|
||||
totalStackedValues?: number[];
|
||||
showValueIndexes?: number[];
|
||||
@@ -182,6 +184,7 @@ export function transformSeries(
|
||||
showValue,
|
||||
onlyTotal,
|
||||
formatter,
|
||||
legendState,
|
||||
totalStackedValues = [],
|
||||
showValueIndexes = [],
|
||||
thresholdValues = [],
|
||||
@@ -308,10 +311,14 @@ export function transformSeries(
|
||||
formatter: (params: any) => {
|
||||
const { value, dataIndex, seriesIndex, seriesName } = params;
|
||||
const numericValue = isHorizontal ? value[0] : value[1];
|
||||
const isSelectedLegend = currentSeries.legend === seriesName;
|
||||
const isSelectedLegend = !legendState || legendState[seriesName];
|
||||
const isAreaExpand = stack === StackControlsValue.Expand;
|
||||
if (!formatter) return numericValue;
|
||||
if (!stack || isSelectedLegend) return formatter(numericValue);
|
||||
if (!formatter) {
|
||||
return numericValue;
|
||||
}
|
||||
if (!stack && isSelectedLegend) {
|
||||
return formatter(numericValue);
|
||||
}
|
||||
if (!onlyTotal) {
|
||||
if (
|
||||
numericValue >=
|
||||
|
||||
Reference in New Issue
Block a user