Add demo for issue #815 - extra space below yAxisMin#963
Merged
Conversation
Demonstrates the problem and the workaround: setYAxisMin(0.0) + setYAxisMax(105.0) + setPlotContentSize(1.0) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #815
Why
When a user calls
setYAxisMin(0.0), they expect the Y-axis to start exactly at zero with no gap below it. Instead, a visible empty space appears beneath zero. The root cause is thatplotContentSize(default ~0.95) computes a symmetric margin on both sides of the axis viaUtils.getTickStartOffset(), so the bottom margin persists even after the min is overridden.Approach
No code change is needed -- the existing API already has a workaround. The fix is to combine three styler calls:
setPlotContentSize(1.0)makes the tick area fill the full plot height so zero sits exactly at the bottom edge. Because this also removes the top margin,setYAxisMax()to a value slightly above the data max (e.g. 105 when data tops out near 100) restores the breathing room at the top.Changes
TestForIssue815.javawith twogetChart*()methods: one reproducing the problem and one showing the fixed output.