mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
This commit is contained in:
committed by
GitHub
parent
f820f9a976
commit
422a07b382
@@ -27,7 +27,6 @@ import {
|
||||
ensureIsArray,
|
||||
GenericDataType,
|
||||
getCustomFormatter,
|
||||
getMetricLabel,
|
||||
getNumberFormatter,
|
||||
getXAxisLabel,
|
||||
isDefined,
|
||||
@@ -292,20 +291,12 @@ export default function transformProps(
|
||||
const showValueIndexesB = extractShowValueIndexes(rawSeriesB, {
|
||||
stack,
|
||||
});
|
||||
|
||||
const metricsLabels = metrics
|
||||
.map(metric => getMetricLabel(metric, undefined, undefined, verboseMap))
|
||||
.filter((label): label is string => label !== undefined);
|
||||
const metricsLabelsB = metricsB.map((metric: QueryFormMetric) =>
|
||||
getMetricLabel(metric, undefined, undefined, verboseMap),
|
||||
);
|
||||
|
||||
const { totalStackedValues, thresholdValues } = extractDataTotalValues(
|
||||
rebasedDataA,
|
||||
{
|
||||
stack,
|
||||
percentageThreshold,
|
||||
metricsLabels,
|
||||
xAxisCol: xAxisLabel,
|
||||
},
|
||||
);
|
||||
const {
|
||||
@@ -314,7 +305,7 @@ export default function transformProps(
|
||||
} = extractDataTotalValues(rebasedDataB, {
|
||||
stack: Boolean(stackB),
|
||||
percentageThreshold,
|
||||
metricsLabels: metricsLabelsB,
|
||||
xAxisCol: xAxisLabel,
|
||||
});
|
||||
|
||||
annotationLayers
|
||||
|
||||
@@ -215,18 +215,14 @@ export default function transformProps(
|
||||
) {
|
||||
xAxisLabel = verboseMap[xAxisLabel];
|
||||
}
|
||||
const metricsLabels = metrics
|
||||
.map(metric => getMetricLabel(metric, undefined, undefined, verboseMap))
|
||||
.filter((label): label is string => label !== undefined);
|
||||
const isHorizontal = orientation === OrientationType.Horizontal;
|
||||
|
||||
const { totalStackedValues, thresholdValues } = extractDataTotalValues(
|
||||
rebasedData,
|
||||
{
|
||||
stack,
|
||||
percentageThreshold,
|
||||
xAxisCol: xAxisLabel,
|
||||
legendState,
|
||||
metricsLabels,
|
||||
},
|
||||
);
|
||||
const extraMetricLabels = extractExtraMetrics(chartProps.rawFormData).map(
|
||||
@@ -300,6 +296,7 @@ export default function transformProps(
|
||||
const entryName = String(entry.name || '');
|
||||
const seriesName = inverted[entryName] || entryName;
|
||||
const colorScaleKey = getOriginalSeries(seriesName, array);
|
||||
|
||||
const transformedSeries = transformSeries(
|
||||
entry,
|
||||
colorScale,
|
||||
|
||||
@@ -60,8 +60,8 @@ export function extractDataTotalValues(
|
||||
opts: {
|
||||
stack: StackType;
|
||||
percentageThreshold: number;
|
||||
xAxisCol: string;
|
||||
legendState?: LegendState;
|
||||
metricsLabels: string[];
|
||||
},
|
||||
): {
|
||||
totalStackedValues: number[];
|
||||
@@ -69,11 +69,11 @@ export function extractDataTotalValues(
|
||||
} {
|
||||
const totalStackedValues: number[] = [];
|
||||
const thresholdValues: number[] = [];
|
||||
const { stack, percentageThreshold, legendState, metricsLabels } = opts;
|
||||
const { stack, percentageThreshold, xAxisCol, legendState } = opts;
|
||||
if (stack) {
|
||||
data.forEach(datum => {
|
||||
const values = Object.keys(datum).reduce((prev, curr) => {
|
||||
if (!metricsLabels.includes(curr)) {
|
||||
if (curr === xAxisCol) {
|
||||
return prev;
|
||||
}
|
||||
if (legendState && !legendState[curr]) {
|
||||
|
||||
Reference in New Issue
Block a user