New option to update bar label position #33135
richardfogaca
started this conversation in
Ideas
Replies: 2 comments
-
This is great! I'd just also support "outside" (supported by ECharts) as that also would put the number below bars that are negative in value. (see #20517) |
Beta Was this translation helpful? Give feedback.
0 replies
-
That makes sense @rusackas , I'll work on a PR with your suggestions, thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Contribution Summary
This contribution adds a new label positioning feature to bar charts in Apache Superset, allowing users to customize where data labels appear on their bar charts. The implementation provides five position options: Inside, Top, Bottom, Left, and Right, with special styling for "Inside" position to ensure readability.
How It Works
The implementation consists of three main components:
Control Panel Addition: A new control section was added to the bar chart configuration panel that allows users to select the label position from a dropdown menu.
Transform Props Integration: The
transformProps
function was updated to handle the newlabelPosition
property, with a default value of "inside" for bar charts when no position is specified.Label Position Utility: A new utility function
updateLabelPosition
was created to handle the positioning logic:The changes maintain backward compatibility by:
Screenshots
Fork with working prototype
The implementation is available in this fork
Why This Matters
This improvement makes bar charts more versatile and user-friendly while maintaining the high standards of Apache Superset's visualization capabilities.
Beta Was this translation helpful? Give feedback.
All reactions