This is an automated email from the ASF dual-hosted git repository. msyavuz pushed a commit to branch msyavuz/fix/categorical-initialization in repository https://gitbox.apache.org/repos/asf/superset.git
commit fbe3f43190902ab3a5e9a50b1ea6ea8f3dfe9910 Author: Mehmet Salih Yavuz <[email protected]> AuthorDate: Wed Jan 14 09:22:53 2026 +0300 fix(controls): Only initialize categorical value on numeric column --- .../src/shared-controls/customControls.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx index fc8f16ee88..47106f67ac 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx @@ -218,8 +218,20 @@ 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) => { + // Only auto-enable for numeric columns (where this control is relevant) + const isNumericXAxis = checkColumnType( + getColumnLabel(state?.controls?.x_axis?.value as QueryFormColumn), + state?.controls?.datasource?.datasource, + [GenericDataType.Numeric], + ); + + if (!isNumericXAxis) { + return control.value; // Don't auto-enable for non-numeric axes + } + + return state?.form_data?.x_axis_sort !== undefined || control.value; + }, renderTrigger: true, visibility: ({ controls }: { controls: ControlStateMapping }) => checkColumnType(
