-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Issue with display of labels with new Bar chart #26159
Comments
@villebro I assigned this issue to you as I think you worked on a feature that might be related. |
@sqja this is intentional, and is to ensure the labels don't overlap. To force the labels to render, you can switch the rotation from 0 degrees to 45 degrees. See an example below with lots of categories: ![]() @sfirke I believe the behavior you're seeing is expected behavior - when the x-axis is numeric or temporal, it will dynamically calculate where to place the ticks/labels. To get the previous behavior (which was in fact a regression from 2.x to 3.0, IIRC), you can cast the numeric x-axis to a string, after which it should render correctly. As a follow-up, we may want to add a control for forcing numerical (or even temporal) x-axes to categorical ones to avoid having to cast to VARCHAR or other categorical type. Thoughts @sfirke @michael-s-molina ? |
This might be a solution given that I didn't see a viable alternative using ECharts. One small change we can do is to add the 90° rotation to the rotation control. Right now it only contains 0° and 45° and even though you can manually enter 90°, it would help given that that's what you'll probably need if you have a large dataset. Keep in mind that by converting temporal and numeric values to categories you will have the same problem outlined by #26034. So it's a trade-off that users need to evaluate but at least we give them the option.
I think having this control is important because manually forcing the conversion will be a painful experience. The y axis may also have a control or we can design the control in such a way that it affects both axes. |
FYI, I believe we used to have a 90 degree option, but it was removed for some reason. I forget what it was, but I also propose adding it back. |
I added a PR to reinstate the 90° option. We also discussed during the PR reviews meeting and agreed that users should be responsible for converting time and numerical columns to categories. Adding a control for that seems a bit overkill given that we may have other types of conversions needed when creating the perfect visualization but we don't offer controls for each of them. I'll close the issue with the guideline to manually convert columns and use label rotation to resolve the problem. |
I'm satisfied with that resolution, thanks for the discussion and restoring the 90 degree rotation. Can we add this to the release notes, as it will be a change that some users may notice and wish to undo? Even if it's not breaking since it's fixing a regression. Maybe we link back to this issue. |
|
Hello,
Previously with legacy bar chart widget (which is now deprecated), we can see a label under every bar.
![image](https://private-user-images.githubusercontent.com/130609036/287294701-c72b47c7-58c4-4223-a3e4-04f1d65f6487.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5ODg3OTksIm5iZiI6MTcyNTk4ODQ5OSwicGF0aCI6Ii8xMzA2MDkwMzYvMjg3Mjk0NzAxLWM3MmI0N2M3LTU4YzQtNDIyMy1hM2U0LTA0ZjFkNjVmNjQ4Ny5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMFQxNzE0NTlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNjcyN2JlOTdmNmY0N2Q1MmVmZWU0Y2FmNjI3OGViYTY2MDY2ODQ0ZmQ5OGZmZDVmMTgxYzViNDVjZjJlZGEwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.KlirIYRw4rZbwKuJ4yDZEJruc-7nSXtp3gNBh8bz9FQ)
With new bar chart widget (with Superset v3.0.1 version), it seems there is no possibility to obtain the same result with a label for every bar, only one bar out of two gets a label.
![image](https://private-user-images.githubusercontent.com/130609036/287293725-fd1b0560-1546-49c6-9c78-fd9fbbfed451.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5ODg3OTksIm5iZiI6MTcyNTk4ODQ5OSwicGF0aCI6Ii8xMzA2MDkwMzYvMjg3MjkzNzI1LWZkMWIwNTYwLTE1NDYtNDljNi05Yzc4LWZkOWZiYmZlZDQ1MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMFQxNzE0NTlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04YTBjZjI2YWI1NjlkMWYzMDk1Y2M3ZTVlNzNiNDdjYWVkMjQ0M2JmMjk4Nzk2ZjhjMzFiMDVmZGFlZWFmNGQwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.XaRqs-dKWvy5QJMNz6_kO1qfIiUa1Rqoo9k1t_-AUls)
The field in X axis is a String, with legacy bar chart it was used in mandatory 'Dimensions' section of the configuration, with the new bar chart it is used in the mandatory 'x-axis' section of the configuration.
Could you please advise if there is a way to attain the same result with new bar chart widget or if it is a regression ?
Best regards
The text was updated successfully, but these errors were encountered: