You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by en...@apache.org on 2026/04/22 12:23:56 UTC

(superset) branch master updated: fix(echarts): increase default axis title margins to prevent label overlap (#39447)

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

EnxDev 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 1903b919d69 fix(echarts): increase default axis title margins to prevent label overlap (#39447)
1903b919d69 is described below

commit 1903b919d699e05a614b5ea2b15d0f88fc3b5b5b
Author: Enzo Martellucci <52...@users.noreply.github.com>
AuthorDate: Wed Apr 22 14:23:48 2026 +0200

    fix(echarts): increase default axis title margins to prevent label overlap (#39447)
---
 .../packages/superset-ui-chart-controls/src/sections/chartTitle.tsx | 6 +++---
 .../plugins/plugin-chart-echarts/src/Bubble/constants.ts            | 4 ++--
 .../plugins/plugin-chart-echarts/src/Bubble/controlPanel.tsx        | 4 ++--
 .../plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx  | 4 ++--
 .../src/Timeseries/Regular/Bar/controlPanel.tsx                     | 4 ++--
 .../plugins/plugin-chart-echarts/src/Timeseries/constants.ts        | 4 ++--
 superset-frontend/plugins/plugin-chart-echarts/src/constants.ts     | 4 ++--
 .../test/MixedTimeseries/transformProps.test.ts                     | 4 ++--
 8 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/sections/chartTitle.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/sections/chartTitle.tsx
index cc98584223d..3720f7437c4 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/sections/chartTitle.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/sections/chartTitle.tsx
@@ -23,7 +23,7 @@ import { ControlPanelSectionConfig } from '../types';
 import { formatSelectOptions } from '../utils';
 
 export const TITLE_MARGIN_OPTIONS: number[] = [
-  0, 15, 30, 50, 75, 100, 125, 150, 200,
+  0, 15, 30, 40, 50, 75, 100, 125, 150, 200,
 ];
 export const TITLE_POSITION_OPTIONS: [string, string][] = [
   ['Left', t('Left')],
@@ -56,7 +56,7 @@ export const titleControls: ControlPanelSectionConfig = {
           clearable: true,
           label: t('X Axis Title Margin'),
           renderTrigger: true,
-          default: TITLE_MARGIN_OPTIONS[0],
+          default: TITLE_MARGIN_OPTIONS[3],
           choices: formatSelectOptions(TITLE_MARGIN_OPTIONS),
         },
       },
@@ -82,7 +82,7 @@ export const titleControls: ControlPanelSectionConfig = {
           clearable: true,
           label: t('Y Axis Title Margin'),
           renderTrigger: true,
-          default: TITLE_MARGIN_OPTIONS[0],
+          default: TITLE_MARGIN_OPTIONS[4],
           choices: formatSelectOptions(TITLE_MARGIN_OPTIONS),
         },
       },
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/constants.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/constants.ts
index 12e928b1396..83d5449ea59 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/constants.ts
@@ -25,8 +25,8 @@ export const DEFAULT_FORM_DATA: Partial<EchartsBubbleFormData> = {
   emitFilter: false,
   logXAis: false,
   logYAxis: false,
-  xAxisTitleMargin: 30,
-  yAxisTitleMargin: 30,
+  xAxisTitleMargin: 40,
+  yAxisTitleMargin: 50,
   truncateXAxis: false,
   truncateYAxis: false,
   xAxisBounds: [null, null],
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/controlPanel.tsx
index ccc176e039f..f0aa4a228fa 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/controlPanel.tsx
@@ -144,7 +144,7 @@ const config: ControlPanelConfig = {
               clearable: true,
               label: t('X axis title margin'),
               renderTrigger: true,
-              default: sections.TITLE_MARGIN_OPTIONS[1],
+              default: sections.TITLE_MARGIN_OPTIONS[3],
               choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
             },
           },
@@ -216,7 +216,7 @@ const config: ControlPanelConfig = {
               clearable: true,
               label: t('Y axis title margin'),
               renderTrigger: true,
-              default: sections.TITLE_MARGIN_OPTIONS[1],
+              default: sections.TITLE_MARGIN_OPTIONS[4],
               choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
             },
           },
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 4c52463936b..6804f9c9784 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
@@ -156,9 +156,9 @@ const defaultFormData: EchartsTimeseriesFormData & {
   showLegend: false,
   legendSort: null,
   xAxisTitle: '',
-  xAxisTitleMargin: 0,
+  xAxisTitleMargin: 40,
   yAxisTitle: '',
-  yAxisTitleMargin: 15,
+  yAxisTitleMargin: 50,
   yAxisTitlePosition: '',
   time_range: 'No filter',
   granularity: undefined,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
index 3eb0f814f93..da95df2d891 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
@@ -92,7 +92,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
           clearable: true,
           label: t('Axis title margin'),
           renderTrigger: true,
-          default: sections.TITLE_MARGIN_OPTIONS[0],
+          default: sections.TITLE_MARGIN_OPTIONS[3],
           choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isVertical(controls) : isHorizontal(controls),
@@ -125,7 +125,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
           clearable: true,
           label: t('Axis title margin'),
           renderTrigger: true,
-          default: sections.TITLE_MARGIN_OPTIONS[1],
+          default: sections.TITLE_MARGIN_OPTIONS[4],
           choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
           visibility: ({ controls }: ControlPanelsContainerProps) =>
             isXAxis ? isHorizontal(controls) : isVertical(controls),
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 472d5fc6525..cdbab53d4f1 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
@@ -44,9 +44,9 @@ export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
   // ...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: '',
-  xAxisTitleMargin: 0,
+  xAxisTitleMargin: 40,
   yAxisTitle: '',
-  yAxisTitleMargin: 15,
+  yAxisTitleMargin: 50,
   yAxisTitlePosition: 'Top',
   // Now that the weird bug workaround is over, here's the rest...
   ...DEFAULT_SORT_SERIES_DATA,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts b/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
index d1169f8a27d..f496b7e2af8 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
@@ -107,9 +107,9 @@ export const DEFAULT_LEGEND_FORM_DATA: LegendFormData = {
 
 export const DEFAULT_TITLE_FORM_DATA: TitleFormData = {
   xAxisTitle: '',
-  xAxisTitleMargin: 0,
+  xAxisTitleMargin: 40,
   yAxisTitle: '',
-  yAxisTitleMargin: 15,
+  yAxisTitleMargin: 50,
   yAxisTitlePosition: 'Top',
 };
 
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 81b3f367084..67ee4500bb8 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
@@ -110,11 +110,11 @@ const formData: EchartsMixedTimeseriesFormData = {
   truncateYAxisSecondary: false,
   xAxisLabelRotation: 0,
   xAxisTitle: '',
-  xAxisTitleMargin: 0,
+  xAxisTitleMargin: 40,
   yAxisBounds: [undefined, undefined],
   yAxisBoundsSecondary: [undefined, undefined],
   yAxisTitle: '',
-  yAxisTitleMargin: 15,
+  yAxisTitleMargin: 50,
   yAxisTitlePosition: '',
   yAxisTitleSecondary: '',
   zoomable: false,