apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
63k stars 13.96k forks source link

Unable to Create Horizontal Time-Series Bar Chart Using Categorical X-Axis #30703

Open allisonseol opened 1 month ago

allisonseol commented 1 month ago

Bug description

Prior to August 2024, we were able to create horizontal bar charts using the Time-series Bar Chart and setting the x-axis as categorical. Recently, the existing horizontal bar chart using the Time-series Bar Chart changes the x-axis to time-series and removes the existing column from Dimensions.

To reproduce:

Note: In my team's existing dashboard, we have multiple horizontal bar charts using the Time-series Bar Chart and setting the x-axis as categorical. Luckily since we did not make any edits to those charts, those charts still display as a horizontal bar chart with a categorical x-axis, but when you click on the 3 dots and Edit chart, that's when you will run into this issue.

Screenshots/recordings

Expected: using Time-series Bar Chart and setting x-axis as categorical Screenshot Expected

Actual: editing existing Time-series Bar Chart and x-axis changes from categorical to time-series Screenshot Actual

Superset version

3.1.3

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

dosubot[bot] commented 1 month ago

Hey @allisonseol! 👋 I'm here to help you with your Superset issue. I can assist with bug fixes, answer questions, and guide you to become a contributor. Let's tackle this together!

The issue you're experiencing with the x-axis changing from categorical to time-series when editing a horizontal bar chart using the Time-series Bar Chart in Superset version 3.1.3 is likely due to the way the xAxisType is determined. The xAxisType is set by the getAxisType function, which considers the stack, xAxisForceCategorical, and xAxisDataType. If the xAxisDataType is identified as GenericDataType.Temporal, the xAxisType is set to AxisType.Time, which is a time-series type [1].

To address this, you might want to check if the xAxisDataType is being incorrectly identified as temporal when it should be categorical. This could be due to changes in how the data type is inferred or configured in recent updates. If xAxisForceCategorical is not set to true, it might not force the axis to remain categorical [2].

Reviewing the configuration of your chart and ensuring that the xAxisForceCategorical is appropriately set might help maintain the categorical x-axis when editing the chart.

To continue talking to Dosu, mention @dosu.