-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bar Chart sorting does not appear to work #30238
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
If you read the mouseover tooltip for SORT BY you'll see that's for something else. That should probably be labeled as "DATA LIMIT SORT BY". What you need is X-AXIS SORT BY, which switches to Y-AXIS SORT BY when a bar chart is switched to horizontal orientation as it appears yours is. I don't know why you don't see that option in your screenshot; are you positive you're running Superset 4.0.2? |
Thank you for your reply. I have now figured out what the problem was. The X-AXIS SORT BY (Y-AXIS SORT BY) didn't appear because of the data type of the column. It only works for STRING data type whilst mine is VAR_STRING. |
How can you change the column type to string? @HJelinkova |
Did you find how? (i am using version 4.0.2 and that option doesn't apear) |
Hello! I'm dealing with the same issue. While I'm still not able to find out how to sort x-axis of bar chart based on some metric (by not showing it on the chart) I found a way how to create STRING column from VAR_STRING. To do this, you should open Edit dataset screen, and select "CALCULATED COLUMNS" tab. There you need to enter SQL expression, which will probably be just the name of the varchar column you want to convert. This will create a new column in your dataset, which is marked as String. I'm attaching 2 screenshots where this beahviour is visible. Now, Sorting option really appears on the screen, as mentioned in the comments above. The next thing I would like to achieve is custom sorting, based on a column which is not shown neither on x-axis or inside bar chart values (metrics field). In my scenario, I have x-axis which is formed out of dates and Identification Numbers of subjects I am analyzing. The date is in the following format: I would want to sort these on x-axis, but based on Does anyone know how I could achieve this? |
@rbosnjak I may be misunderstanding, but in your bottom pic, the X axis DOES look like it's sorting |
Bug description
It is imposible to change the layout of the bar chart by using the "Sort by" function.
The ASC/DESC checkbox changes the query but the chart stays unaffected.
Same issues previously reported: #15260, #15318
How to reproduce the bug
Screenshots/recordings
Superset version
4.0.2
Python version
Python 3.10.14
Node version
NODE version 20
Browser
Chrome
Additional context
Note: Superset installed using docker.
Checklist
The text was updated successfully, but these errors were encountered: