mirror of
https://github.com/apache/superset.git
synced 2026-06-01 05:39:17 +00:00
fix(treemap): remove gaps between chart nodes (#40181)
This commit is contained in:
@@ -21,8 +21,8 @@ import { TreePathInfo } from '../types';
|
||||
|
||||
export const COLOR_SATURATION = [0.7, 0.4];
|
||||
export const LABEL_FONTSIZE = 11;
|
||||
export const BORDER_WIDTH = 2;
|
||||
export const GAP_WIDTH = 2;
|
||||
export const BORDER_WIDTH = 0;
|
||||
export const GAP_WIDTH = 0;
|
||||
|
||||
export const extractTreePathInfo = (
|
||||
treePathInfo: TreePathInfo[] | undefined,
|
||||
|
||||
@@ -214,7 +214,8 @@ export default function transformProps(
|
||||
colorAlpha: OpacityEnum.SemiTransparent,
|
||||
color: theme.colorText,
|
||||
borderColor: theme.colorBgBase,
|
||||
borderWidth: 2,
|
||||
borderWidth: BORDER_WIDTH,
|
||||
gapWidth: GAP_WIDTH,
|
||||
},
|
||||
label: {
|
||||
...labelProps,
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
import { ChartProps } from '@superset-ui/core';
|
||||
import { supersetTheme } from '@apache-superset/core/theme';
|
||||
import { OpacityEnum } from '../../src/constants';
|
||||
import { EchartsTreemapChartProps } from '../../src/Treemap/types';
|
||||
import transformProps from '../../src/Treemap/transformProps';
|
||||
|
||||
@@ -74,4 +75,44 @@ describe('Treemap transformProps', () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
test('should not render gaps between treemap nodes when filtered', () => {
|
||||
const filteredChartProps = new ChartProps({
|
||||
...chartProps,
|
||||
filterState: { selectedValues: ['Sylvester,bar1'] },
|
||||
});
|
||||
|
||||
expect(
|
||||
transformProps(filteredChartProps as EchartsTreemapChartProps),
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
echartOptions: expect.objectContaining({
|
||||
series: [
|
||||
expect.objectContaining({
|
||||
data: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
children: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
name: 'Arnold',
|
||||
children: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
name: 'bar2',
|
||||
itemStyle: expect.objectContaining({
|
||||
borderWidth: 0,
|
||||
gapWidth: 0,
|
||||
colorAlpha: OpacityEnum.SemiTransparent,
|
||||
}),
|
||||
label: expect.objectContaining({}),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user