Skip to content

Add demo for issue #815 - extra space below yAxisMin#963

Merged
timmolter merged 1 commit into
developfrom
timmolter/issue-815-demo
Jun 6, 2026
Merged

Add demo for issue #815 - extra space below yAxisMin#963
timmolter merged 1 commit into
developfrom
timmolter/issue-815-demo

Conversation

@timmolter

Copy link
Copy Markdown
Member

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 that plotContentSize (default ~0.95) computes a symmetric margin on both sides of the axis via Utils.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:

chart.getStyler().setYAxisMin(0.0);
chart.getStyler().setYAxisMax(105.0);   // hardcode a comfortable top bound
chart.getStyler().setPlotContentSize(1.0); // removes the symmetric margin

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

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>
@timmolter timmolter merged commit e2e258b into develop Jun 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to remove extra space below min y-axis value?

1 participant