Skip to content

Commit 0086aaa

Browse files
committed
do not add extra pad for inside ticklabels with matches and scaleanchor
1 parent d87320a commit 0086aaa

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/plots/cartesian/autorange.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ function makePadFn(ax, max) {
206206
// 5% padding for points that specify extrapad: true
207207
var extrappad = 0.05 * ax._length;
208208

209+
var anchorAxis = ax._anchorAxis || {};
210+
209211
if(
210212
(ax.ticklabelposition || '').indexOf('inside') !== -1 ||
211-
((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1
213+
(anchorAxis.ticklabelposition || '').indexOf('inside') !== -1
212214
) {
213215
var axReverse = ax.autorange === 'reversed';
214216
if(!axReverse) {
@@ -218,8 +220,16 @@ function makePadFn(ax, max) {
218220
if(axReverse) max = !max;
219221
}
220222

221-
var A = padInsideLabelsOnAnchorAxis(ax, max);
222-
var B = padInsideLabelsOnThisAxis(ax, max);
223+
var A = 0;
224+
var B = 0;
225+
226+
if(
227+
!anchorAxis.matches && !ax.matches &&
228+
!anchorAxis.scaleanchor && !ax.scaleanchor
229+
) {
230+
A = padInsideLabelsOnAnchorAxis(ax, max);
231+
B = padInsideLabelsOnThisAxis(ax, max);
232+
}
223233

224234
var zero = Math.max(A, B);
225235
extrappad = Math.max(zero, extrappad);
@@ -273,7 +283,7 @@ function padInsideLabelsOnThisAxis(ax, max) {
273283

274284
function padInsideLabelsOnAnchorAxis(ax, max) {
275285
var pad = 0;
276-
var anchorAxis = (ax._anchorAxis || {});
286+
var anchorAxis = ax._anchorAxis || {};
277287
if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) {
278288
// increase padding to make more room for inside tick labels of the counter axis
279289
if((
Loading
Loading
-90 Bytes
Loading

0 commit comments

Comments
 (0)