From 859e627c30abc8f2a400a7e52889889d09f6b4b5 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Sun, 17 Aug 2025 10:36:47 -0700 Subject: [PATCH] fix: Restore all missing features to Pie control panel - Added back outer radius slider control with min/max constraints - Added conditional inner radius control that only shows when Donut is checked - Added color palette selector component - Added conditional Label Line control that only shows when Show Labels is checked - Fixed double headers on Metric and Group by controls by removing duplicate labels - All controls now properly configured with renderTrigger where appropriate --- .../src/Pie/PieControlPanelSimple.tsx | 99 ++++++++++++++++++- 1 file changed, 95 insertions(+), 4 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/PieControlPanelSimple.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/PieControlPanelSimple.tsx index cbdd3a586a3..5bd462fa0f4 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/PieControlPanelSimple.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/PieControlPanelSimple.tsx @@ -18,11 +18,14 @@ */ import { FC } from 'react'; import { t } from '@superset-ui/core'; +import { ColorSchemeControl } from '@superset-ui/chart-controls'; import { DndColumnSelect } from '../../../../src/explore/components/controls/DndColumnSelectControl/DndColumnSelect'; import { DndMetricSelect } from '../../../../src/explore/components/controls/DndColumnSelectControl/DndMetricSelect'; import TextControl from '../../../../src/explore/components/controls/TextControl'; import CheckboxControl from '../../../../src/explore/components/controls/CheckboxControl'; +import SliderControl from '../../../../src/explore/components/controls/SliderControl'; import ControlHeader from '../../../../src/explore/components/ControlHeader'; +import Control from '../../../../src/explore/components/Control'; interface PieControlPanelProps { onChange?: (field: string, value: any) => void; @@ -81,7 +84,7 @@ export const PieControlPanel: FC = ({

{t('Query')}

- {/* Group by */} + {/* Group by - NO DOUBLE HEADER */}
= ({ onChange={handleChange('groupby')} options={safeColumns} name="groupby" - label={t('Group by')} + label="" // Remove the duplicate label multi canDelete ghostButtonText={t('Add dimension')} @@ -108,7 +111,7 @@ export const PieControlPanel: FC = ({ )}
- {/* Metric */} + {/* Metric - NO DOUBLE HEADER */}
= ({ onChange={handleChange('metric')} datasource={safeDataSource} name="metric" - label={t('Metric')} + label="" // Remove the duplicate label multi={false} savedMetrics={safeMetrics} /> @@ -164,6 +167,43 @@ export const PieControlPanel: FC = ({

{t('Chart Options')}

+ {/* Color Scheme */} +
+ {(() => { + const colorSchemeControl = ColorSchemeControl(); + const { hidden, ...cleanConfig } = colorSchemeControl.config || {}; + return ( + { + handleChange('color_scheme')(val); + }, + }} + renderTrigger + /> + ); + })()} +
+ + {/* Outer Radius Slider */} +
+ + +
+ {/* Donut checkbox */}
= ({ />
+ {/* Inner Radius Slider - CONDITIONAL */} + {formValues.donut && ( +
+ + +
+ )} + {/* Show Labels checkbox */}
= ({ />
+ {/* Label Line checkbox - CONDITIONAL */} + {formValues.show_labels && ( +
+ +
+ )} + {/* Show Legend checkbox */}