-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
feat(barchart): Add direction attribute. (horizontal bars support) #325
Conversation
Codecov Report
@@ Coverage Diff @@
## main #325 +/- ##
==========================================
+ Coverage 87.08% 87.41% +0.33%
==========================================
Files 40 40
Lines 9822 10096 +274
==========================================
+ Hits 8553 8825 +272
- Misses 1269 1271 +2
|
71e6fc7
to
0f6e5d5
Compare
Thanks for the PR! Horizontal bar charts look great. It looks like there's a merge conflict in one of the tests. Would you be able to address that? |
nice pr, hope merge |
ac93e1b
to
fd6704d
Compare
fd6704d
to
2bcc894
Compare
@kdheepak done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely is something that will be useful. This needs some docs about how it works and some more detailed testing. There's a couple of places where I'm not sure what the behavior should be, so I'm not sure if it's a bug or an non-intuitive feature that you've considered.
0eeb54c
to
5967c49
Compare
0a775fb
to
532be7b
Compare
181b82f
to
b35af7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of small typos, but generally looks good to me. If you can get these fixed up in the next few days this should make the 0.23 release.
I'd still query whether bottom to top rendering is the correct approach, but happy to take that as a future PR if needed.
@joshka I don't care much. I slightly like printing from the bottom. here I made a comparison. It will be nice if you choose, which one looks better? (it will not require much time changing it) top: (ignore the misplaced group labels) (here we should maybe move the legend to the bottom ) |
or maybe let's do in future PR, as you mentioned. maybe we make it configurable. Variable name would be |
Yep that's a good way to handle it |
Let's go top down for the first release and add another property in sometime soon in a .1 release? |
ok fine. |
Enable rendring the bars horizontally. In some cases this allow us to make more efficient use of the available space. Signed-off-by: Ben Fekih, Hichem <[email protected]>
This is a breaking change, since the alignment by default is set to Left and the group labels are always rendered in the center. Signed-off-by: Ben Fekih, Hichem <[email protected]>
b35af7f
to
4de7ecb
Compare
@joshka done. Now it looks like the following: |
LGTM. Thanks again for the PR and for your patience sticking with it to get this reviewed and merged. |
@ratatui-org/core can someone please take a second review on this? |
Merging! Thanks @karthago1 and @kdheepak for the review |
Fixes #321
this patch introduces new function
direction
to allow the barchart to render the bars horizontally.Note: when
direction
is set toDirection::Horizontal
the functionBar::label()
is useless, because the bar label is nowhere printed.any suggestion how to make the horizontal bar look better?
The bar's
value_text
is rendered using 2 styles (value_style
and thebar_style
). Reason: see the following image 😄