mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix(echarts): prevent plain legend clipping in dashboards (#38675)
This commit is contained in:
committed by
GitHub
parent
3fb903fdc6
commit
12aca72074
@@ -37,7 +37,8 @@ import {
|
||||
OrientationType,
|
||||
EchartsTimeseriesFormData,
|
||||
} from '../../src/Timeseries/types';
|
||||
import { StackControlsValue } from '../../src/constants';
|
||||
import { StackControlsValue, TIMESERIES_CONSTANTS } from '../../src/constants';
|
||||
import { LegendOrientation, LegendType } from '../../src/types';
|
||||
import { DEFAULT_FORM_DATA } from '../../src/Timeseries/constants';
|
||||
import { createEchartsTimeseriesTestChartProps } from '../helpers';
|
||||
import { BASE_TIMESTAMP, createTestData } from './helpers';
|
||||
@@ -898,6 +899,40 @@ describe('legend sorting', () => {
|
||||
'Boston',
|
||||
]);
|
||||
});
|
||||
|
||||
test('falls back to scroll for zoomable top legends when toolbox space reduces available width', () => {
|
||||
const narrowLegendData = [
|
||||
createTestQueryData(
|
||||
createTestData(
|
||||
[
|
||||
{
|
||||
Alpha: 1,
|
||||
Beta: 2,
|
||||
Gamma: 3,
|
||||
},
|
||||
],
|
||||
{ intervalMs: 300000000 },
|
||||
),
|
||||
),
|
||||
];
|
||||
const chartProps = createTestChartProps({
|
||||
width: 190 + TIMESERIES_CONSTANTS.legendTopRightOffset,
|
||||
formData: {
|
||||
...formData,
|
||||
legendType: LegendType.Plain,
|
||||
legendOrientation: LegendOrientation.Top,
|
||||
showLegend: true,
|
||||
zoomable: true,
|
||||
},
|
||||
queriesData: narrowLegendData,
|
||||
});
|
||||
|
||||
const transformed = transformProps(chartProps);
|
||||
|
||||
expect((transformed.echartOptions.legend as any).type).toBe(
|
||||
LegendType.Scroll,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
const timeCompareFormData: SqlaFormData = {
|
||||
|
||||
Reference in New Issue
Block a user