Skip to content

Provide minimal padding for inside tick labels case of bar, heatmap, line plots #5325

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

Merged
merged 7 commits into from
Dec 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/plots/cartesian/autorange.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,18 @@ function makePadFn(ax, max) {
extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max);
extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max);

var pad0 = 0;
pad0 = adjustPadForInsideLabelsOnAnchorAxis(pad0, ax, max);
pad0 = adjustPadForInsideLabelsOnThisAxis(pad0, ax, max);

// domain-constrained axes: base extrappad on the unconstrained
// domain so it's consistent as the domain changes
if((ax.constrain === 'domain') && ax._inputDomain) {
extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) /
(ax.domain[1] - ax.domain[0]);
}

return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); };
return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : pad0); };
}

var TEXTPAD = 3;
Expand Down