GitHub user mcwleong edited a comment on the discussion: Cannot sort X-Axis on a bar chart if X-axis is a var_string (MySQL)
I've found a workaround. As raised by @mason-gordon that this is related to how superset converts MySQL data into its generic string datatype. However, Under "Computed Column" of the dataset, you can create a new computed column with SQL Expression = your_varchar_col_name. Set the column data type to String. Use this computed column as x-axis of your bar chart. Superset will then allow you to sort the x axis using metrics. This workaround comes with an extra benefit on allowing you to set your_varchar_col_name as dimension, which enables cross filtering across different chart in the dashboard. You will need to set the "Stacked Style" in the Customize tab to "Stack" to yield a visually identical chart tho. (Note: cross filtering works on selecting chart dimensions on a bar chart only, but superset will not allow the same column to be x-axis and dimension at the same time). GitHub link: https://github.com/apache/superset/discussions/29271#discussioncomment-15316942 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
