Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dnschnur
Copy link
Member

Flot 0.8 added logic to account for the size of axis tick labels and add padding around the edges of the plot, to prevent long labels from sticking out. But it padded both sides equally, which is incorrect if the right/top side has no last axis label.

Fixed by allocating padding per-side, and checking whether the last label would be shown before padding the top or right. Fixes #1048.

Flot 0.8 added logic to account for the size of axis tick labels and add
padding around the edges of the plot, to prevent long labels from
sticking out.  But it padded both sides equally, which is incorrect if
the right/top side has no last axis label.

Fixed by allocating padding per-side, and checking whether the last
label would be shown before padding the top or right.  Fixes flot#1048.
@ghost ghost assigned dnschnur Nov 26, 2013
dnschnur added a commit that referenced this pull request Nov 26, 2013
Don't add padding when there's no last tick.
@dnschnur dnschnur merged commit 08d5bfa into flot:master Nov 26, 2013
@dnschnur dnschnur deleted the xaxis-plot-size-fix branch November 26, 2013 04:14
dnschnur added a commit that referenced this pull request Nov 28, 2013
This was accidentally introduced by #1200; we can’t assume that
axis.ticks is an array.
dnschnur added a commit to dnschnur/flot that referenced this pull request Apr 20, 2014
The fix for an unnecessary gap on the right of the chart turned out to
break text wrapping for ticks that were legitimately in that position.

Fixes flot#1283.
dnschnur added a commit that referenced this pull request Apr 20, 2014
if (axis.reserveSpace && lastTick) {
if (axis.direction === "x") {
margins.left = Math.max(margins.left, axis.labelWidth / 2);
if (lastTick.v <= axis.max) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify what this check actually does? Why should we have ticks that are outside the axis?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different size of chart with X-Axis vs. size of chart without X-Axis

2 participants