mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat: Enables ECharts legend selector (#23590)
This commit is contained in:
committed by
GitHub
parent
adcb8cf0ac
commit
30f210b842
@@ -226,7 +226,7 @@ export default function transformProps(
|
||||
}),
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend),
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, theme),
|
||||
data: keys,
|
||||
},
|
||||
series,
|
||||
|
||||
@@ -171,6 +171,7 @@ export default function transformProps(
|
||||
inContextMenu,
|
||||
filterState,
|
||||
emitCrossFilters,
|
||||
theme,
|
||||
} = chartProps;
|
||||
const data: DataRecord[] = queriesData[0].data || [];
|
||||
|
||||
@@ -324,7 +325,7 @@ export default function transformProps(
|
||||
),
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend),
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, theme),
|
||||
data: categoryList,
|
||||
},
|
||||
series,
|
||||
|
||||
@@ -458,7 +458,13 @@ export default function transformProps(
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, zoomable),
|
||||
...getLegendProps(
|
||||
legendType,
|
||||
legendOrientation,
|
||||
showLegend,
|
||||
theme,
|
||||
zoomable,
|
||||
),
|
||||
// @ts-ignore
|
||||
data: rawSeriesA
|
||||
.concat(rawSeriesB)
|
||||
|
||||
@@ -315,7 +315,7 @@ export default function transformProps(
|
||||
}),
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend),
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, theme),
|
||||
data: keys,
|
||||
},
|
||||
graphic: showTotal
|
||||
|
||||
@@ -237,7 +237,7 @@ export default function transformProps(
|
||||
trigger: 'item',
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend),
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, theme),
|
||||
data: Array.from(columnsLabelMap.keys()),
|
||||
},
|
||||
series,
|
||||
|
||||
@@ -469,7 +469,13 @@ export default function transformProps(
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, zoomable),
|
||||
...getLegendProps(
|
||||
legendType,
|
||||
legendOrientation,
|
||||
showLegend,
|
||||
theme,
|
||||
zoomable,
|
||||
),
|
||||
data: legendData as string[],
|
||||
},
|
||||
series: dedupSeries(series),
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
NumberFormatter,
|
||||
TimeFormatter,
|
||||
AxisType,
|
||||
SupersetTheme,
|
||||
} from '@superset-ui/core';
|
||||
import { format, LegendComponentOption, SeriesOption } from 'echarts';
|
||||
import { sumBy, meanBy, minBy, maxBy, orderBy } from 'lodash';
|
||||
@@ -288,6 +289,7 @@ export function getLegendProps(
|
||||
type: LegendType,
|
||||
orientation: LegendOrientation,
|
||||
show: boolean,
|
||||
theme: SupersetTheme,
|
||||
zoomable = false,
|
||||
): LegendComponentOption | LegendComponentOption[] {
|
||||
const legend: LegendComponentOption | LegendComponentOption[] = {
|
||||
@@ -298,6 +300,13 @@ export function getLegendProps(
|
||||
: 'vertical',
|
||||
show,
|
||||
type,
|
||||
selector: ['all', 'inverse'],
|
||||
selectorLabel: {
|
||||
fontFamily: theme.typography.families.sansSerif,
|
||||
fontSize: theme.typography.sizes.s,
|
||||
color: theme.colors.grayscale.base,
|
||||
borderColor: theme.colors.grayscale.base,
|
||||
},
|
||||
};
|
||||
switch (orientation) {
|
||||
case LegendOrientation.Left:
|
||||
|
||||
Reference in New Issue
Block a user