You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by li...@apache.org on 2024/04/03 23:05:11 UTC

(superset) branch master updated: fix(bar-chart): change legend padding for horizontal orientation (#27883)

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

lilykuang 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 cfa0556df7 fix(bar-chart): change legend padding for horizontal orientation (#27883)
cfa0556df7 is described below

commit cfa0556df7a6d82257deff7753b82628229c6e8c
Author: Lily Kuang <li...@preset.io>
AuthorDate: Wed Apr 3 16:05:04 2024 -0700

    fix(bar-chart): change legend padding for horizontal orientation (#27883)
---
 .../plugin-chart-echarts/src/Timeseries/transformers.ts     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
index b5ff791fbe..3b5cfd594a 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
@@ -563,6 +563,11 @@ export function getPadding(
     ? TIMESERIES_CONSTANTS.yAxisLabelTopOffset
     : 0;
   const xAxisOffset = addXAxisTitleOffset ? Number(xAxisTitleMargin) || 0 : 0;
+  const showLegendTopOffset =
+    isHorizontal && showLegend && legendOrientation === LegendOrientation.Top
+      ? 100
+      : 0;
+
   return getChartPadding(
     showLegend,
     legendOrientation,
@@ -570,8 +575,12 @@ export function getPadding(
     {
       top:
         yAxisTitlePosition && yAxisTitlePosition === 'Top'
-          ? TIMESERIES_CONSTANTS.gridOffsetTop + (Number(yAxisTitleMargin) || 0)
-          : TIMESERIES_CONSTANTS.gridOffsetTop + yAxisOffset,
+          ? TIMESERIES_CONSTANTS.gridOffsetTop +
+            showLegendTopOffset +
+            (Number(yAxisTitleMargin) || 0)
+          : TIMESERIES_CONSTANTS.gridOffsetTop +
+            showLegendTopOffset +
+            yAxisOffset,
       bottom:
         zoomable && !isHorizontal
           ? TIMESERIES_CONSTANTS.gridOffsetBottomZoomable + xAxisOffset