This is an automated email from the ASF dual-hosted git repository.

SBIN2010 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 23f10960f5a feat(plugin-chart-echarts): let users hide legend 
All/Invert buttons (#45172)
23f10960f5a is described below

commit 23f10960f5a04f08bd3a6d9a9e5abed9ebfb62c6
Author: SBIN2010 <[email protected]>
AuthorDate: Fri Oct 23 18:23:28 2026 +0300

    feat(plugin-chart-echarts): let users hide legend All/Invert buttons 
(#45172)
    
    Co-authored-by: Romain GREFFIER 
<[email protected]>
    Co-authored-by: Enzo Martellucci <[email protected]>
---
 .../src/Bubble/transformProps.ts                   |  3 ++
 .../src/Butterfly/transformProps.ts                |  3 ++
 .../src/Candlestick/transformProps.ts              |  3 ++
 .../src/Funnel/controlPanel.tsx                    | 13 +++++++--
 .../src/Funnel/transformProps.ts                   |  3 ++
 .../src/Gantt/transformProps.ts                    |  3 ++
 .../src/Graph/transformProps.ts                    |  3 ++
 .../src/Histogram/controlPanel.tsx                 |  7 ++++-
 .../src/Histogram/transformProps.ts                |  2 ++
 .../plugin-chart-echarts/src/Histogram/types.ts    |  1 +
 .../src/MixedTimeseries/transformProps.ts          |  3 ++
 .../plugin-chart-echarts/src/Pie/transformProps.ts |  3 ++
 .../src/Radar/transformProps.ts                    |  3 ++
 .../src/Timeseries/EchartsTimeseries.test.tsx      |  1 +
 .../src/Timeseries/constants.ts                    |  1 +
 .../src/Timeseries/transformProps.ts               |  9 ++++--
 .../plugins/plugin-chart-echarts/src/constants.ts  |  1 +
 .../plugins/plugin-chart-echarts/src/controls.tsx  | 25 +++++++++++++++--
 .../plugins/plugin-chart-echarts/src/types.ts      |  1 +
 .../plugin-chart-echarts/src/utils/series.ts       |  5 +++-
 .../test/Gantt/transformProps.test.ts              |  7 ++++-
 .../test/Histogram/buildQuery.test.ts              |  1 +
 .../test/Histogram/transformProps.test.ts          |  1 +
 .../test/MixedTimeseries/transformProps.test.ts    |  1 +
 .../test/Timeseries/transformProps.test.ts         | 30 ++++++++++++++++++++
 .../plugin-chart-echarts/test/utils/series.test.ts | 32 ++++++++++++++++++++--
 superset/translations/messages.pot                 |  6 ++++
 27 files changed, 160 insertions(+), 11 deletions(-)

diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts
index 05889651e4d..524a1ae7b0e 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts
@@ -153,6 +153,7 @@ export default function transformProps(chartProps: 
EchartsBubbleChartProps) {
     tooltipSizeFormat,
     opacity,
     showLegend,
+    showSelectorLegend,
     legendOrientation,
     legendMargin,
     legendType,
@@ -224,6 +225,7 @@ export default function transformProps(chartProps: 
EchartsBubbleChartProps) {
     legendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -291,6 +293,7 @@ export default function transformProps(chartProps: 
EchartsBubbleChartProps) {
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         false,
         legendState,
       ),
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Butterfly/transformProps.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/src/Butterfly/transformProps.ts
index c0b5cb14c72..8ce7333adeb 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Butterfly/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Butterfly/transformProps.ts
@@ -123,6 +123,7 @@ export default function transformProps(
     legendType,
     legendSort,
     showValue,
+    showSelectorLegend,
     xAxisLabelRotation,
   }: EchartsButterflyChartProps['formData'] = {
     ...DEFAULT_FORM_DATA,
@@ -254,6 +255,7 @@ export default function transformProps(
     legendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -286,6 +288,7 @@ export default function transformProps(
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         false,
         legendState,
       ),
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts
index 7f9d61b28e6..e9eb16d4dd4 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts
@@ -355,6 +355,7 @@ export default function transformProps(
     tooltipTimeFormat,
     tooltipValuesFormat,
     showLegend,
+    showSelectorLegend,
     legendMargin,
     legendOrientation = LegendOrientation.Top,
     legendType = LegendType.Scroll,
@@ -596,6 +597,7 @@ export default function transformProps(
     legendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -645,6 +647,7 @@ export default function transformProps(
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         zoomable,
         legendState,
       ),
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx 
b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
index 67910b1b71a..59f1440bb25 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
@@ -36,8 +36,17 @@ import { legendSection } from '../controls';
 const { labelType, numberFormat, showLabels, defaultTooltipLabel } =
   DEFAULT_FORM_DATA;
 
-const funnelLegendSection = [...legendSection];
-funnelLegendSection.splice(2, 1);
+// Funnel keeps legend orientation and drops type; the row is matched by name
+// so inserting another legend control does not remove the wrong one.
+const funnelLegendSection = legendSection.filter(row => {
+  const [control] = row;
+  return (
+    !control ||
+    typeof control !== 'object' ||
+    !('name' in control) ||
+    control.name !== 'legendType'
+  );
+});
 
 const config: ControlPanelConfig = {
   controlPanelSections: [
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
index c45d6288ce9..77f034e1c66 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
@@ -128,6 +128,7 @@ export default function transformProps(
     inContextMenu,
     showTooltipLabels,
     showLegend,
+    showSelectorLegend,
     sliceId,
     percentCalculationType,
   }: EchartsFunnelFormData = {
@@ -270,6 +271,7 @@ export default function transformProps(
     legendMargin: resolvedLegendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -335,6 +337,7 @@ export default function transformProps(
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         false,
         legendState,
       ),
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts
index c8249c16f4b..d801e7e5b27 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts
@@ -149,6 +149,7 @@ export default function transformProps(chartProps: 
EchartsGanttChartProps) {
     legendType,
     legendSort,
     showLegend,
+    showSelectorLegend,
     yAxisTitle,
     yAxisTitleMargin,
     xAxisTitle,
@@ -419,6 +420,7 @@ export default function transformProps(chartProps: 
EchartsGanttChartProps) {
     legendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -470,6 +472,7 @@ export default function transformProps(chartProps: 
EchartsGanttChartProps) {
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         zoomable,
         legendState,
         padding,
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Graph/transformProps.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Graph/transformProps.ts
index 06b9923ed90..d7be83dd0be 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Graph/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Graph/transformProps.ts
@@ -202,6 +202,7 @@ export default function transformProps(
     legendType,
     legendSort,
     showLegend,
+    showSelectorLegend,
     baseEdgeWidth,
     baseNodeSize,
     edgeSymbol,
@@ -340,6 +341,7 @@ export default function transformProps(
     legendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -403,6 +405,7 @@ export default function transformProps(
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         false,
         legendState,
       ),
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/controlPanel.tsx 
b/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/controlPanel.tsx
index 889f9c04edd..438d4f6f4cb 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/controlPanel.tsx
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/controlPanel.tsx
@@ -32,7 +32,11 @@ import {
   D3_FORMAT_DOCS,
   D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT,
 } from '@superset-ui/chart-controls';
-import { showLegendControl, showValueControl } from '../controls';
+import {
+  showLegendControl,
+  showSelectorLegendControl,
+  showValueControl,
+} from '../controls';
 
 const config: ControlPanelConfig = {
   controlPanelSections: [
@@ -115,6 +119,7 @@ const config: ControlPanelConfig = {
         ['color_scheme'],
         [showValueControl],
         [showLegendControl],
+        [showSelectorLegendControl],
         [
           {
             name: 'x_axis_title',
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/transformProps.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/transformProps.ts
index 3cbc8a61b67..2a646a09519 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/transformProps.ts
@@ -59,6 +59,7 @@ export default function transformProps(
     groupby = [],
     normalize,
     showLegend,
+    showSelectorLegend,
     showValue,
     sliceId,
     xAxisFormat,
@@ -189,6 +190,7 @@ export default function transformProps(
         LegendOrientation.Top,
         showLegend,
         theme,
+        showSelectorLegend,
         false,
         legendState,
       ),
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/types.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/types.ts
index ab3d4b75c2e..978f4313d42 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Histogram/types.ts
@@ -27,6 +27,7 @@ export type HistogramFormData = QueryFormData & {
   normalize: boolean;
   sliceId: number;
   showLegend: boolean;
+  showSelectorLegend: boolean;
   showValue: boolean;
   xAxisFormat: string;
   xAxisTitle: string;
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
index c7d26641657..ade4d985481 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
@@ -208,6 +208,7 @@ export default function transformProps(
     seriesType,
     seriesTypeB,
     showLegend,
+    showSelectorLegend,
     showValue,
     showValueB,
     labelPosition,
@@ -823,6 +824,7 @@ export default function transformProps(
     legendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -1082,6 +1084,7 @@ export default function transformProps(
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         zoomable,
         legendState,
         chartPadding,
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts
index 89f8fc2398c..861b7876d29 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts
@@ -274,6 +274,7 @@ export default function transformProps(
     outerRadius,
     showLabels,
     showLegend,
+    showSelectorLegend,
     showLabelsThreshold,
     startAngle,
     sweptAngle,
@@ -516,6 +517,7 @@ export default function transformProps(
     legendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -602,6 +604,7 @@ export default function transformProps(
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         false,
         legendState,
       ),
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts
index d638b8ef251..25a91cf3a6a 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts
@@ -125,6 +125,7 @@ export default function transformProps(
     dateFormat,
     showLabels,
     showLegend,
+    showSelectorLegend,
     legendSort,
     isCircle,
     columnConfig,
@@ -376,6 +377,7 @@ export default function transformProps(
     legendMargin,
     orientation: legendOrientation,
     show: showLegend,
+    showSelectors: showSelectorLegend !== false,
     theme,
     type: legendType,
   });
@@ -441,6 +443,7 @@ export default function transformProps(
         legendOrientation,
         showLegend,
         theme,
+        showSelectorLegend,
         false,
         legendState,
       ),
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
index f0e0cafa451..64239935870 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
@@ -172,6 +172,7 @@ const defaultFormData: EchartsTimeseriesFormData & {
   legendOrientation: LegendOrientation.Top,
   legendType: LegendType.Plain,
   showLegend: false,
+  showSelectorLegend: true,
   legendSort: null,
   xAxisTitle: '',
   xAxisTitleMargin: 40,
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
index 158963865bd..a2bb0c2dd9f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
@@ -42,6 +42,7 @@ export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
   legendOrientation: LegendOrientation.Top,
   legendType: LegendType.Scroll,
   showLegend: true,
+  showSelectorLegend: true,
   // ...DEFAULT_TITLE_FORM_DATA, // TODO: figure out why these break things 
for stories (e.g. Bubble Chart)
   // here are the contents of DEFAULT_TITLE_FORM_DATA:
   xAxisTitle: '',
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
index 20a740afa00..ee71d11df5f 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
@@ -168,6 +168,7 @@ function buildTimeseriesCustomLegend({
   legendState,
   orientation,
   series,
+  showSelectors,
 }: {
   fallbackColor: string;
   grid: TimeseriesCustomLegend['grid'];
@@ -176,6 +177,7 @@ function buildTimeseriesCustomLegend({
   legendState?: LegendState;
   orientation: LegendOrientation.Top | LegendOrientation.Bottom;
   series: SeriesOption[];
+  showSelectors: boolean;
 }): TimeseriesCustomLegend {
   const firstSeriesByName = new Map<string, SeriesOption>();
   series.forEach(seriesOption => {
@@ -212,7 +214,7 @@ function buildTimeseriesCustomLegend({
     grid,
     items,
     orientation,
-    showSelectors: interactive,
+    showSelectors,
   };
 }
 
@@ -353,6 +355,7 @@ export default function transformProps(
     richTooltip,
     seriesType,
     showLegend,
+    showSelectorLegend,
     showValue,
     valueLabelPosition,
     size,
@@ -1401,7 +1404,7 @@ export default function transformProps(
       legendMargin: candidateLegendMargin,
       orientation: legendOrientation,
       show: nativeLegendVisible,
-      showSelectors: !usesPrimaryAxisLegend,
+      showSelectors: !usesPrimaryAxisLegend && showSelectorLegend !== false,
       theme,
       type: legendType,
     });
@@ -1810,6 +1813,7 @@ export default function transformProps(
         legendOrientation,
         nativeLegendVisible,
         theme,
+        showSelectorLegend,
         zoomable,
         legendState,
         padding,
@@ -1916,6 +1920,7 @@ export default function transformProps(
               : padding.top,
         },
         interactive: !usesPrimaryAxisLegend,
+        showSelectors: !usesPrimaryAxisLegend && showSelectorLegend !== false,
         legendNames: resolvedLegendNames,
         legendState,
         orientation: legendOrientation,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
index aa707e0d71a..adb1e070189 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
@@ -141,6 +141,7 @@ export const DEFAULT_LEGEND_FORM_DATA: LegendFormData = {
   legendType: LegendType.Scroll,
   showLegend: true,
   legendSort: null,
+  showSelectorLegend: true,
 };
 
 export const DEFAULT_TITLE_FORM_DATA: TitleFormData = {
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx 
b/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx
index a36bb260a48..c47e41ec49d 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx
@@ -37,8 +37,13 @@ import { DEFAULT_FORM_DATA } from './Timeseries/constants';
 import { BarValueLabelPosition } from './Timeseries/types';
 import { defaultXAxis } from './defaults';
 
-const { legendMargin, legendOrientation, legendType, showLegend } =
-  DEFAULT_LEGEND_FORM_DATA;
+const {
+  legendMargin,
+  legendOrientation,
+  legendType,
+  showLegend,
+  showSelectorLegend,
+} = DEFAULT_LEGEND_FORM_DATA;
 
 export const showLegendControl: ControlSetItem = {
   name: 'show_legend',
@@ -51,6 +56,21 @@ export const showLegendControl: ControlSetItem = {
   },
 };
 
+export const showSelectorLegendControl: ControlSetItem = {
+  name: 'show_selector_legend',
+  config: {
+    type: 'CheckboxControl',
+    label: t('Show All/Invert buttons in legend'),
+    renderTrigger: true,
+    default: showSelectorLegend,
+    description: t(
+      'Toggle to show/hide the "All/Invert" buttons in the legend.',
+    ),
+    visibility: ({ controls }: ControlPanelsContainerProps) =>
+      Boolean(controls?.show_legend?.value),
+  },
+};
+
 const legendMarginControl: ControlSetItem = {
   name: 'legendMargin',
   config: {
@@ -124,6 +144,7 @@ export const legendSortControl: ControlSetItem = {
 export const legendSection: ControlSetRow[] = [
   [<ControlSubSectionHeader>{t('Legend')}</ControlSubSectionHeader>],
   [showLegendControl],
+  [showSelectorLegendControl],
   [legendTypeControl],
   [legendOrientationControl],
   [legendMarginControl],
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/types.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/types.ts
index 8328bd62b61..d8a72b24bcb 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/types.ts
@@ -101,6 +101,7 @@ export type LegendFormData = {
   legendType: LegendType;
   showLegend: boolean;
   legendSort: 'asc' | 'desc' | null;
+  showSelectorLegend: boolean;
 };
 
 export type EventHandlers = Record<string, { (props: any): void }>;
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts
index 789f0d21b81..9ed4231c229 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts
@@ -896,6 +896,7 @@ export function getLegendProps(
   orientation: LegendOrientation,
   show: boolean,
   theme: SupersetTheme,
+  showSelectorLegend = true,
   zoomable = false,
   legendState?: LegendState,
   padding?: LegendPaddingType,
@@ -919,7 +920,9 @@ export function getLegendProps(
         }
       : {}),
     selected: legendState ?? {},
-    selector: ['all', 'inverse'],
+    // `selector: false` omits the All/Inv group from legend layout.
+    // The shorthand lets ECharts fill button titles from the chart locale.
+    selector: showSelectorLegend ? ['all', 'inverse'] : false,
     selectorLabel: {
       fontFamily: theme.fontFamily,
       fontSize: theme.fontSizeSM,
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/transformProps.test.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/transformProps.test.ts
index 9e69c70d32a..53e7609f2af 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/transformProps.test.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/transformProps.test.ts
@@ -56,6 +56,7 @@ const formData: EchartsGanttFormData = {
   legendOrientation: LegendOrientation.Top,
   legendType: LegendType.Scroll,
   showLegend: true,
+  showSelectorLegend: true,
   sortSeriesAscending: true,
   legendSort: null,
 };
@@ -140,6 +141,7 @@ describe('Gantt transformProps', () => {
           legend: expect.objectContaining({
             show: true,
             type: 'scroll',
+            selector: ['all', 'inverse'],
           }),
           tooltip: {
             formatter: expect.anything(),
@@ -613,7 +615,10 @@ test('reserves grid room for category names so they are 
not clipped (#38844)', (
       queriesData: [
         {
           ...queriesData[0],
-          data: queriesData[0].data.map(datum => ({ ...datum, 'Y Axis': 'a' 
})),
+          data: queriesData[0].data.map(datum => ({
+            ...datum,
+            'Y Axis': 'a',
+          })),
         },
       ],
     }) as EchartsGanttChartProps,
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/test/Histogram/buildQuery.test.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/test/Histogram/buildQuery.test.ts
index 1726b02f983..074e4f3b287 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/test/Histogram/buildQuery.test.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/test/Histogram/buildQuery.test.ts
@@ -30,6 +30,7 @@ const baseFormData: HistogramFormData = {
   normalize: false,
   sliceId: 1,
   showLegend: false,
+  showSelectorLegend: true,
   showValue: false,
   xAxisFormat: '',
   xAxisTitle: '',
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/test/Histogram/transformProps.test.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/test/Histogram/transformProps.test.ts
index 83b5b491915..a38ed17bc94 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/test/Histogram/transformProps.test.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/test/Histogram/transformProps.test.ts
@@ -36,6 +36,7 @@ const formData: HistogramFormData = {
   normalize: false,
   sliceId: 1,
   showLegend: true,
+  showSelectorLegend: true,
   showValue: false,
   xAxisFormat: '',
   xAxisTitle: '',
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
index 6fa27290a68..6963ac976b1 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
@@ -130,6 +130,7 @@ const formData: EchartsMixedTimeseriesFormData = {
   legendOrientation: LegendOrientation.Top,
   legendType: LegendType.Scroll,
   showLegend: false,
+  showSelectorLegend: false,
   showValue: false,
   showValueB: false,
   stack: true,
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
index 07b8cf3f015..3e23bc400f8 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
@@ -1467,6 +1467,36 @@ test('moves a visible horizontal Plain legend into a 
custom HTML legend and rest
   expect('contentHeight' in transformed).toBe(false);
 });
 
+test('hides legend selector buttons when showSelectorLegend is false', () => {
+  const plain = transformProps(
+    createTestChartProps({
+      formData: {
+        ...formData,
+        legendOrientation: LegendOrientation.Top,
+        legendType: LegendType.Plain,
+        showLegend: true,
+        showSelectorLegend: false,
+      },
+    }),
+  );
+  expect(getCustomLegend(plain)?.showSelectors).toBe(false);
+
+  const scroll = transformProps(
+    createTestChartProps({
+      formData: {
+        ...formData,
+        legendOrientation: LegendOrientation.Top,
+        legendType: LegendType.Scroll,
+        showLegend: true,
+        showSelectorLegend: false,
+      },
+    }),
+  );
+  expect(
+    (scroll.echartOptions.legend as { selector?: false | unknown[] }).selector,
+  ).toBe(false);
+});
+
 test.each([LegendOrientation.Top, LegendOrientation.Bottom])(
   'uses the custom HTML legend for a %s-oriented Plain legend',
   legendOrientation => {
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts 
b/superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts
index 6a6bf084f01..c018129567a 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts
@@ -1132,6 +1132,7 @@ describe('getLegendProps', () => {
         LegendOrientation.Top,
         true,
         theme,
+        true,
         false,
       ),
     ).toEqual({
@@ -1152,6 +1153,7 @@ describe('getLegendProps', () => {
         true,
         theme,
         true,
+        true,
       ),
     ).toEqual({
       show: true,
@@ -1174,6 +1176,7 @@ describe('getLegendProps', () => {
       true,
       theme,
       true,
+      true,
     );
     const TOOLBOX_ICONS_RIGHT_FOOTPRINT = 67;
     const SAFETY_MARGIN = 15;
@@ -1184,7 +1187,13 @@ describe('getLegendProps', () => {
 
   test('should return the correct props for plain type with left orientation', 
() => {
     expect(
-      getLegendProps(LegendType.Plain, LegendOrientation.Left, true, theme),
+      getLegendProps(
+        LegendType.Plain,
+        LegendOrientation.Left,
+        true,
+        theme,
+        true,
+      ),
     ).toEqual({
       show: true,
       left: 0,
@@ -1201,6 +1210,7 @@ describe('getLegendProps', () => {
         LegendOrientation.Right,
         false,
         theme,
+        true,
         false,
       ),
     ).toEqual({
@@ -1221,6 +1231,7 @@ describe('getLegendProps', () => {
         false,
         theme,
         true,
+        true,
       ),
     ).toEqual({
       show: false,
@@ -1234,7 +1245,13 @@ describe('getLegendProps', () => {
 
   test('should return the correct props for plain type with bottom 
orientation', () => {
     expect(
-      getLegendProps(LegendType.Plain, LegendOrientation.Bottom, false, theme),
+      getLegendProps(
+        LegendType.Plain,
+        LegendOrientation.Bottom,
+        false,
+        theme,
+        true,
+      ),
     ).toEqual({
       show: false,
       bottom: 0,
@@ -1257,6 +1274,17 @@ describe('getLegendProps', () => {
       ...expectedThemeProps,
     });
   });
+
+  test('omits All and Inv buttons when showSelectorLegend is false', () => {
+    const legend = getLegendProps(
+      LegendType.Plain,
+      LegendOrientation.Top,
+      true,
+      theme,
+      false,
+    );
+    expect(legend.selector).toBe(false);
+  });
 });
 
 test('getLegendLayoutResult keeps plain horizontal legends when they fit 
within two rows', () => {
diff --git a/superset/translations/messages.pot 
b/superset/translations/messages.pot
index 8357aa41ebe..8aad0b9bb2e 100644
--- a/superset/translations/messages.pot
+++ b/superset/translations/messages.pot
@@ -12641,6 +12641,9 @@ msgid_plural "Show %s more changes"
 msgstr[0] ""
 msgstr[1] ""
 
+msgid "Show All/Invert buttons in legend"
+msgstr ""
+
 msgid "Show Bubbles"
 msgstr ""
 
@@ -15441,6 +15444,9 @@ msgid_plural "To request access, reach out to the chart 
owners: %s."
 msgstr[0] ""
 msgstr[1] ""
 
+msgid "Toggle to show/hide the \"All/Invert\" buttons in the legend."
+msgstr ""
+
 msgid "Token Request URI"
 msgstr ""
 

Reply via email to