alexandrusoare commented on code in PR #37115:
URL: https://github.com/apache/superset/pull/37115#discussion_r2693707677
##########
superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx:
##########
@@ -218,8 +218,17 @@ export const xAxisForceCategoricalControl = {
label: () => t('Force categorical'),
default: false,
description: t('Treat values as categorical.'),
- initialValue: (control: ControlState, state: ControlPanelState | null) =>
- state?.form_data?.x_axis_sort !== undefined || control.value,
+ initialValue: (control: ControlState, state: ControlPanelState | null) => {
+ const isNumericXAxis = checkColumnType(
+ getColumnLabel(state?.controls?.x_axis?.value as QueryFormColumn),
+ state?.controls?.datasource?.datasource,
+ [GenericDataType.Numeric],
+ );
+ if (!isNumericXAxis) {
+ return control.value;
+ }
+ return state?.form_data?.x_axis_sort !== undefined || control.value;
Review Comment:
Could x_axis_sort be null as well?
--
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]