This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 21f85a4145 feat(tree chart): add initial tree depth to tree chart
(#35425)
21f85a4145 is described below
commit 21f85a414511cf298b6f6531792b846e59926a56
Author: SBIN2010 <[email protected]>
AuthorDate: Tue Nov 18 20:40:51 2025 +0300
feat(tree chart): add initial tree depth to tree chart (#35425)
---
.../plugins/plugin-chart-echarts/src/Tree/constants.ts | 1 +
.../plugin-chart-echarts/src/Tree/controlPanel.tsx | 17 +++++++++++++++++
.../plugin-chart-echarts/src/Tree/transformProps.ts | 2 ++
.../plugins/plugin-chart-echarts/src/Tree/types.ts | 1 +
4 files changed, 21 insertions(+)
diff --git
a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/constants.ts
b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/constants.ts
index 38c3eb9498..eb0b5f9bc8 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/constants.ts
@@ -42,4 +42,5 @@ export const DEFAULT_FORM_DATA: Partial<EchartsTreeFormData>
= {
nodeLabelPosition: 'left',
childLabelPosition: 'bottom',
emphasis: 'descendant',
+ initialTreeDepth: 2,
};
diff --git
a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx
b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx
index 4d8b0fa978..8ff20ffe58 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx
@@ -279,6 +279,23 @@ const controlPanel: ControlPanelConfig = {
},
},
],
+ [
+ {
+ name: 'initialTreeDepth',
+ config: {
+ type: 'NumberControl',
+ label: t('Initial tree depth'),
+ min: -1,
+ step: 1,
+ max: 10,
+ default: DEFAULT_FORM_DATA.initialTreeDepth,
+ renderTrigger: true,
+ description: t(
+ 'The initial level (depth) of the tree. If set as -1 all nodes
are expanded.',
+ ),
+ },
+ },
+ ],
],
},
],
diff --git
a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/transformProps.ts
b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/transformProps.ts
index 0e3dcf8aa5..a4336162f3 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/transformProps.ts
@@ -74,6 +74,7 @@ export default function transformProps(
nodeLabelPosition,
childLabelPosition,
emphasis,
+ initialTreeDepth,
}: EchartsTreeFormData = { ...DEFAULT_FORM_DATA, ...formData };
const metricLabel = getMetricLabel(metric);
@@ -203,6 +204,7 @@ export default function transformProps(
},
select: DEFAULT_TREE_SERIES_OPTION.select,
leaves: { label: { position: childLabelPosition } },
+ initialTreeDepth,
},
];
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/types.ts
b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/types.ts
index 394837cb60..71cd7df907 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/types.ts
@@ -36,6 +36,7 @@ export type EchartsTreeFormData = QueryFormData & {
nodeLabelPosition: 'top' | 'bottom' | 'left' | 'right';
childLabelPosition: 'top' | 'bottom' | 'left' | 'right';
emphasis: 'none' | 'ancestor' | 'descendant';
+ initialTreeDepth: number;
};
export interface TreeChartDataResponseResult extends ChartDataResponseResult {