feat(MixedTimeSeries): Add onlyTotal and Sort Series to Mixed TimeSeries (#33634)

This commit is contained in:
nmdo
2025-06-09 17:59:54 -04:00
committed by GitHub
parent 2f007bf7a5
commit d11b6d557e
2 changed files with 87 additions and 20 deletions

View File

@@ -173,6 +173,8 @@ export default function transformProps(
showLegend,
showValue,
showValueB,
onlyTotal,
onlyTotalB,
stack,
stackB,
truncateXAxis,
@@ -203,6 +205,10 @@ export default function transformProps(
yAxisTitleMargin,
yAxisTitlePosition,
sliceId,
sortSeriesType,
sortSeriesTypeB,
sortSeriesAscending,
sortSeriesAscendingB,
timeGrainSqla,
percentageThreshold,
metrics = [],
@@ -223,18 +229,42 @@ export default function transformProps(
}
const rebasedDataA = rebaseForecastDatum(data1, verboseMap);
const { totalStackedValues, thresholdValues } = extractDataTotalValues(
rebasedDataA,
{
stack,
percentageThreshold,
xAxisCol: xAxisLabel,
},
);
const MetricDisplayNameA = getMetricDisplayName(metrics[0], verboseMap);
const MetricDisplayNameB = getMetricDisplayName(metricsB[0], verboseMap);
const [rawSeriesA] = extractSeries(rebasedDataA, {
const [rawSeriesA, sortedTotalValuesA] = extractSeries(rebasedDataA, {
fillNeighborValue: stack ? 0 : undefined,
xAxis: xAxisLabel,
sortSeriesType,
sortSeriesAscending,
stack,
totalStackedValues,
});
const rebasedDataB = rebaseForecastDatum(data2, verboseMap);
const [rawSeriesB] = extractSeries(rebasedDataB, {
const {
totalStackedValues: totalStackedValuesB,
thresholdValues: thresholdValuesB,
} = extractDataTotalValues(rebasedDataB, {
stack: Boolean(stackB),
percentageThreshold,
xAxisCol: xAxisLabel,
});
const [rawSeriesB, sortedTotalValuesB] = extractSeries(rebasedDataB, {
fillNeighborValue: stackB ? 0 : undefined,
xAxis: xAxisLabel,
sortSeriesType: sortSeriesTypeB,
sortSeriesAscending: sortSeriesAscendingB,
stack: Boolean(stackB),
totalStackedValues: totalStackedValuesB,
});
const dataTypes = getColtypesMapping(queriesData[0]);
@@ -292,25 +322,11 @@ export default function transformProps(
);
const showValueIndexesA = extractShowValueIndexes(rawSeriesA, {
stack,
onlyTotal,
});
const showValueIndexesB = extractShowValueIndexes(rawSeriesB, {
stack,
});
const { totalStackedValues, thresholdValues } = extractDataTotalValues(
rebasedDataA,
{
stack,
percentageThreshold,
xAxisCol: xAxisLabel,
},
);
const {
totalStackedValues: totalStackedValuesB,
thresholdValues: thresholdValuesB,
} = extractDataTotalValues(rebasedDataB, {
stack: Boolean(stackB),
percentageThreshold,
xAxisCol: xAxisLabel,
onlyTotal,
});
annotationLayers
@@ -406,6 +422,7 @@ export default function transformProps(
areaOpacity: opacity,
seriesType,
showValue,
onlyTotal,
stack: Boolean(stack),
stackIdSuffix: '\na',
yAxisIndex,
@@ -420,8 +437,8 @@ export default function transformProps(
formatter: seriesFormatter,
})
: seriesFormatter,
totalStackedValues: sortedTotalValuesA,
showValueIndexes: showValueIndexesA,
totalStackedValues,
thresholdValues,
timeShiftColor,
},
@@ -464,6 +481,7 @@ export default function transformProps(
areaOpacity: opacityB,
seriesType: seriesTypeB,
showValue: showValueB,
onlyTotal: onlyTotalB,
stack: Boolean(stackB),
stackIdSuffix: '\nb',
yAxisIndex: yAxisIndexB,
@@ -478,8 +496,8 @@ export default function transformProps(
formatter: seriesFormatter,
})
: seriesFormatter,
totalStackedValues: sortedTotalValuesB,
showValueIndexes: showValueIndexesB,
totalStackedValues: totalStackedValuesB,
thresholdValues: thresholdValuesB,
timeShiftColor,
},