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

   <!-- Greeting -->
   Hey @snippins! I'm here to help you with this bug. I'm a bot designed to 
assist with bug solving, answer questions, and guide you to become a 
contributor. Let's tackle this issue together!
   
   <!-- Answer -->
   The `xAxisForceCategoricalControl` is indeed incorrectly hidden in a bar 
chart with a categorical x-axis and a numeric y-axis because its visibility 
check only considers the x-axis type. The visibility check should also consider 
the y-axis type to ensure the control is shown appropriately.
   
   Currently, the visibility check is:
   
   ```tsx
   visibility: ({ controls }: { controls: ControlStateMapping }) =>
     checkColumnType(
       getColumnLabel(controls?.x_axis?.value as QueryFormColumn),
       controls?.datasource?.datasource,
       [GenericDataType.Numeric],
     ),
   ```
   
   To fix this, the visibility check should be updated to also consider the 
y-axis type. Here is the revised version:
   
   ```tsx
   visibility: ({ controls }: { controls: ControlStateMapping }) =>
     checkColumnType(
       getColumnLabel(controls?.x_axis?.value as QueryFormColumn),
       controls?.datasource?.datasource,
       [GenericDataType.Numeric],
     ) && checkColumnType(
       getColumnLabel(controls?.y_axis?.value as QueryFormColumn),
       controls?.datasource?.datasource,
       [GenericDataType.Numeric],
     ),
   ```
   
   This ensures that the `xAxisForceCategoricalControl` is visible only when 
both the x-axis and y-axis columns are numeric, which is appropriate for a bar 
chart with a categorical x-axis and a numeric y-axis 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.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