dosubot[bot] commented on issue #29342:
URL: https://github.com/apache/superset/issues/29342#issuecomment-2186409477

   <!-- Greeting -->
   Hi @seandiacono 👋, I'm here to assist you with any issues you encounter. I 
can help you solve bugs, answer questions, and even guide you on becoming a 
contributor.
   
   <!-- Answer -->
   To resolve the issue of excessive padding when adding a legend to horizontal 
bar charts in Apache Superset version 4.0.1, you need to refer to the changes 
introduced in PR #27883. This PR specifically addresses the legend padding for 
horizontal orientation in bar charts.
   
   Here is the relevant entry from the changelog:
   
   ```md
   - [#27883](https://github.com/apache/superset/pull/27883) fix(bar-chart): 
change legend padding for horizontal orientation (@lilykuang)
   ```
   
   To fix the issue, ensure that your Superset instance includes the changes 
from PR #27883. If you are experiencing excessive padding, it might be due to a 
configuration or a bug that was addressed in this PR. Updating to version 4.0.1 
or ensuring that this PR's changes are applied should resolve the issue.
   
   Additionally, you can adjust the legend settings in the chart controls to 
fine-tune the padding. The `legendMargin`, `legendOrientation`, and 
`showLegend` controls can be configured to manage the legend's appearance and 
padding. Here are the relevant controls from the `controls.tsx` file:
   
   ```tsx
   const { legendMargin, legendOrientation, legendType, showLegend } =
     DEFAULT_LEGEND_FORM_DATA;
   
   export const showLegendControl: ControlSetItem = {
     name: 'show_legend',
     config: {
       type: 'CheckboxControl',
       label: t('Show legend'),
       renderTrigger: true,
       default: showLegend,
       description: t('Whether to display a legend for the chart'),
     },
   };
   
   const legendMarginControl: ControlSetItem = {
     name: 'legendMargin',
     config: {
       type: 'TextControl',
       label: t('Margin'),
       renderTrigger: true,
       isInt: true,
       default: legendMargin,
       description: t('Additional padding for legend.'),
       visibility: ({ controls }: ControlPanelsContainerProps) =>
         Boolean(controls?.show_legend?.value),
     },
   };
   
   const legendOrientationControl: ControlSetItem = {
     name: 'legendOrientation',
     config: {
       type: 'SelectControl',
       freeForm: false,
       label: t('Orientation'),
       choices: [
         ['top', t('Top')],
         ['bottom', t('Bottom')],
         ['left', t('Left')],
         ['right', t('Right')],
       ],
       default: legendOrientation,
       renderTrigger: true,
       description: t('Legend Orientation'),
       visibility: ({ controls }: ControlPanelsContainerProps) =>
         Boolean(controls?.show_legend?.value),
     },
   };
   
   export const legendSection: ControlSetRow[] = [
     [<ControlSubSectionHeader>{t('Legend')}</ControlSubSectionHeader>],
     [showLegendControl],
     [legendTypeControl],
     [legendOrientationControl],
     [legendMarginControl],
   ];
   ```
   
   By ensuring the correct configuration and applying the changes from PR 
#27883, you should be able to resolve the excessive padding issue in your 
horizontal bar charts 
<sup>[[1]](https://github.com/apache/superset/blob/master/CHANGELOG/4.0.1.md)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to