mirror of
https://github.com/apache/superset.git
synced 2026-04-21 17:14:57 +00:00
fix(plugin-chart-echarts): invalid total label location for negative values in stacked bar chart (#21032)
This commit is contained in:
@@ -77,6 +77,8 @@ export function extractShowValueIndexes(
|
||||
series: SeriesOption[],
|
||||
opts: {
|
||||
stack: StackType;
|
||||
onlyTotal?: boolean;
|
||||
isHorizontal?: boolean;
|
||||
},
|
||||
): number[] {
|
||||
const showValueIndexes: number[] = [];
|
||||
@@ -84,9 +86,20 @@ export function extractShowValueIndexes(
|
||||
series.forEach((entry, seriesIndex) => {
|
||||
const { data = [] } = entry;
|
||||
(data as [any, number][]).forEach((datum, dataIndex) => {
|
||||
if (datum[1] !== null) {
|
||||
if (!opts.onlyTotal && datum[opts.isHorizontal ? 0 : 1] !== null) {
|
||||
showValueIndexes[dataIndex] = seriesIndex;
|
||||
}
|
||||
if (opts.onlyTotal) {
|
||||
if (datum[opts.isHorizontal ? 0 : 1] > 0) {
|
||||
showValueIndexes[dataIndex] = seriesIndex;
|
||||
}
|
||||
if (
|
||||
!showValueIndexes[dataIndex] &&
|
||||
datum[opts.isHorizontal ? 0 : 1] !== null
|
||||
) {
|
||||
showValueIndexes[dataIndex] = seriesIndex;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user