fix(plugin-chart-echarts): reorder totals and support multimetric sort (#23675)

This commit is contained in:
Ville Brofeldt
2023-04-14 20:43:15 +03:00
committed by GitHub
parent 47fd73255e
commit cbbcc8d2e1
6 changed files with 244 additions and 120 deletions

View File

@@ -126,6 +126,7 @@ export default function transformProps(
logAxis,
markerEnabled,
markerSize,
metrics,
minorSplitLine,
onlyTotal,
opacity,
@@ -193,7 +194,9 @@ export default function transformProps(
getMetricLabel,
);
const rawSeries = extractSeries(rebasedData, {
const isMultiSeries = groupby.length || metrics.length > 1;
const [rawSeries, sortedTotalValues] = extractSeries(rebasedData, {
fillNeighborValue: stack && !forecastEnabled ? 0 : undefined,
xAxis: xAxisLabel,
extraMetricLabels,
@@ -202,8 +205,8 @@ export default function transformProps(
isHorizontal,
sortSeriesType,
sortSeriesAscending,
xAxisSortSeries: groupby.length ? xAxisSortSeries : undefined,
xAxisSortSeriesAscending: groupby.length
xAxisSortSeries: isMultiSeries ? xAxisSortSeries : undefined,
xAxisSortSeriesAscending: isMultiSeries
? xAxisSortSeriesAscending
: undefined,
});
@@ -240,7 +243,7 @@ export default function transformProps(
formatter,
showValue,
onlyTotal,
totalStackedValues,
totalStackedValues: sortedTotalValues,
showValueIndexes,
thresholdValues,
richTooltip,