-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add Bottom to LabelPosition for Cartesian Charts #721
Add Bottom to LabelPosition for Cartesian Charts #721
Conversation
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.
Hello, and thanks for the PR! When LabelPosition.Bottom
is applied, DefaultCartesianMarker
should request a bottom inset to ensure that there’s enough room for the label. There may not be a bottom axis, or the height of the label may exceed that of the bottom axis. Could you update getInsets
(line 189) accordingly? This modification won’t change the end result in instances where there’s already sufficient room.
Hey @patrickmichalik, thanks for the feedback 😄
Ah, missed that! Good point, wouldn't look good without that. I've tested it and it works nicely after this commit: f56e3fd Here's a couple screenshots, I've added some background colors so we can easily identify the chart's size
It took me a while to notice that Changing the code to use Let me know if you'd prefer the previous implementation there (in |
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.
Thanks, @L-Andrade! The changes that you mention look good. I have three minor suggestions.
sample/src/main/java/com/patrykandpatrick/vico/sample/showcase/Marker.kt
Outdated
Show resolved
Hide resolved
sample/src/main/java/com/patrykandpatrick/vico/sample/showcase/Marker.kt
Outdated
Show resolved
Hide resolved
...core/src/main/java/com/patrykandpatrick/vico/core/cartesian/marker/DefaultCartesianMarker.kt
Outdated
Show resolved
Hide resolved
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.
Cheers! @Gowsky is on a business trip at the moment, but he told me before leaving that he didn’t have any further suggestions, so we’re ready to go.
Thanks @patrickmichalik! |
For completeness, I wanted to note that I missed a minor issue here. Whatever the condition for the bottom shadow inset being added may be, its size should be different than that of the top shadow inset. This is because the shadow is always shifted downward by 2 dp. I erroneously concluded that two different sizes would be required only once the out-of-scope change mentioned is made—perhaps because I flipped the shadow along with the label background in my head. I should’ve suggested defining two sizes, at which point the logic might as well have been updated to always add both shadow insets, even if this isn’t strictly related. I hadn’t yet merged the PR when I realized this, but it’s a small thing, and it’s my mistake for overlooking it in the review. I apologize. I’ll take care of it when removing the conditional behavior. |
@patrickmichalik Sorry for missing it too - makes sense. Let me know if you need anything from my side! |
Adds
Bottom
as aLabelPosition
, which positions at the bottom of the graph. Basically the inverse ofTop
.Solves #701