mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(echarts): prevent plain legend clipping in dashboards (#38675)
(cherry picked from commit 12aca72074)
This commit is contained in:
committed by
Michael S. Molina
parent
9619fa2156
commit
1e7d781354
@@ -45,6 +45,7 @@ import {
|
||||
getColtypesMapping,
|
||||
getLegendProps,
|
||||
} from '../utils/series';
|
||||
import { resolveLegendLayout } from '../utils/legendLayout';
|
||||
import { defaultGrid } from '../defaults';
|
||||
import { Refs } from '../types';
|
||||
import { getDefaultTooltip } from '../utils/tooltip';
|
||||
@@ -313,11 +314,27 @@ export default function transformProps(
|
||||
min,
|
||||
};
|
||||
});
|
||||
const legendData = Array.from(columnsLabelMap.keys()).sort(
|
||||
(a: string, b: string) => {
|
||||
if (!legendSort) return 0;
|
||||
return legendSort === 'asc' ? a.localeCompare(b) : b.localeCompare(a);
|
||||
},
|
||||
);
|
||||
const { effectiveLegendMargin, effectiveLegendType } = resolveLegendLayout({
|
||||
chartHeight: height,
|
||||
chartWidth: width,
|
||||
legendItems: legendData,
|
||||
legendMargin,
|
||||
orientation: legendOrientation,
|
||||
show: showLegend,
|
||||
theme,
|
||||
type: legendType,
|
||||
});
|
||||
|
||||
const series: RadarSeriesOption[] = [
|
||||
{
|
||||
type: 'radar',
|
||||
...getChartPadding(showLegend, legendOrientation, legendMargin),
|
||||
...getChartPadding(showLegend, legendOrientation, effectiveLegendMargin),
|
||||
animation: false,
|
||||
emphasis: {
|
||||
label: {
|
||||
@@ -354,11 +371,13 @@ export default function transformProps(
|
||||
formatter: NormalizedTooltipFormater,
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, theme),
|
||||
data: Array.from(columnsLabelMap.keys()).sort((a: string, b: string) => {
|
||||
if (!legendSort) return 0;
|
||||
return legendSort === 'asc' ? a.localeCompare(b) : b.localeCompare(a);
|
||||
}),
|
||||
...getLegendProps(
|
||||
effectiveLegendType,
|
||||
legendOrientation,
|
||||
showLegend,
|
||||
theme,
|
||||
),
|
||||
data: legendData,
|
||||
},
|
||||
series,
|
||||
radar: {
|
||||
|
||||
Reference in New Issue
Block a user