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

   <!-- Answer -->
   The issue arises because the visibility conditions for the X-axis and Y-axis 
titles are interdependent. Specifically, the visibility of the X-axis title 
controls depends on the chart orientation being vertical, and the visibility of 
the Y-axis title controls depends on the chart orientation being horizontal. 
When both `createAxisTitleControl('x')` and `createAxisTitleControl('y')` are 
used, they might conflict due to these interdependencies.
   
   Here is the relevant code snippet showing the visibility conditions:
   
   ```tsx
   function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
     const isXAxis = axis === 'x';
     const isVertical = (controls: ControlStateMapping) =>
       Boolean(controls?.orientation.value === OrientationType.Vertical);
     const isHorizontal = (controls: ControlStateMapping) =>
       Boolean(controls?.orientation.value === OrientationType.Horizontal);
     return [
       [
         {
           name: 'x_axis_title',
           config: {
             type: 'TextControl',
             label: t('Axis Title'),
             renderTrigger: true,
             default: '',
             description: t('Changing this control takes effect instantly'),
             visibility: ({ controls }: ControlPanelsContainerProps) =>
               isXAxis ? isVertical(controls) : isHorizontal(controls),
           },
         },
       ],
       [
         {
           name: 'x_axis_title_margin',
           config: {
             type: 'SelectControl',
             freeForm: true,
             clearable: true,
             label: t('AXIS TITLE MARGIN'),
             renderTrigger: true,
             default: sections.TITLE_MARGIN_OPTIONS[0],
             choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
             description: t('Changing this control takes effect instantly'),
             visibility: ({ controls }: ControlPanelsContainerProps) =>
               isXAxis ? isVertical(controls) : isHorizontal(controls),
           },
         },
       ],
       [
         {
           name: 'y_axis_title',
           config: {
             type: 'TextControl',
             label: t('Axis Title'),
             renderTrigger: true,
             default: '',
             description: t('Changing this control takes effect instantly'),
             visibility: ({ controls }: ControlPanelsContainerProps) =>
               isXAxis ? isHorizontal(controls) : isVertical(controls),
           },
         },
       ],
       [
         {
           name: 'y_axis_title_margin',
           config: {
             type: 'SelectControl',
             freeForm: true,
             clearable: true,
             label: t('AXIS TITLE MARGIN'),
             renderTrigger: true,
             default: sections.TITLE_MARGIN_OPTIONS[0],
             choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
             description: t('Changing this control takes effect instantly'),
             visibility: ({ controls }: ControlPanelsContainerProps) =>
               isXAxis ? isHorizontal(controls) : isVertical(controls),
           },
         },
       ],
     ];
   }
   ```
   
   When you comment out `...createAxisTitleControl('y')`, the conflicting 
visibility conditions are removed, allowing the X-axis title to work correctly 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.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