Skip to content

Commit

Permalink
remove one unnecessary check - improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Dec 9, 2020
1 parent 15b002a commit 0b254e7
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 12 deletions.
13 changes: 4 additions & 9 deletions src/plots/cartesian/autorange.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,12 @@ function makePadFn(fullLayout, ax, max) {
var A = 0;
var B = 0;
if(!isLinked(fullLayout, ax._id)) {
A = padInsideLabelsOnAnchorAxis(ax, max);
if(
ax.rangemode !== 'tozero' &&
ax.rangemode !== 'nonnegative'
anchorAxis.rangemode !== 'tozero' &&
anchorAxis.rangemode !== 'nonnegative'
) {
A = padInsideLabelsOnAnchorAxis(ax, max);
if(
anchorAxis.rangemode !== 'tozero' &&
anchorAxis.rangemode !== 'nonnegative'
) {
B = padInsideLabelsOnThisAxis(ax, max);
}
B = padInsideLabelsOnThisAxis(ax, max);
}
}

Expand Down
Binary file modified test/image/baselines/ticklabelposition-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/image/baselines/ticklabelposition-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions test/image/mocks/ticklabelposition-5.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
"gridcolor": "white"
},
"yaxis4": {
"autorange": "reversed",
"rangemode": "nonnegative",
"anchor": "x4",
"domain": [0.525, 1],
Expand All @@ -170,12 +171,12 @@
"gridcolor": "white"
},
"font": {
"size": 24
"size": 16
},
"plot_bgcolor": "lightblue",
"showlegend": false,
"width": 1000,
"height": 1000,
"width": 800,
"height": 800,
"margin": {
"t": 40,
"b": 40,
Expand Down
90 changes: 90 additions & 0 deletions test/image/mocks/ticklabelposition-6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"data": [{
"xaxis": "x",
"yaxis": "y",
"orientation": "h",
"x": [0.4, 0.5, 0.6, 0.7, 0.8],
"y": ["Oo", "Pp", "Qq", "Rr", "Ss"]
}, {
"xaxis": "x2",
"yaxis": "y2",
"orientation": "h",
"x": [0.4, 0.5, 0.6, 0.7, 0.8],
"y": ["Oo", "Pp", "Qq", "Rr", "Ss"]
}, {
"xaxis": "x3",
"yaxis": "y3",
"orientation": "v",
"y": [0.4, 0.5, 0.6, 0.7, 0.8],
"x": ["Oo", "Pp", "Qq", "Rr", "Ss"]
}, {
"xaxis": "x4",
"yaxis": "y4",
"orientation": "v",
"y": [0.4, 0.5, 0.6, 0.7, 0.8],
"x": ["Oo", "Pp", "Qq", "Rr", "Ss"]
}],
"layout": {
"xaxis": {
"rangemode": "nonnegative",
"anchor": "y",
"domain": [0, 0.475],
"gridcolor": "white"
},
"yaxis": {
"anchor": "x",
"domain": [0, 0.475],
"ticklabelposition": "inside",
"gridcolor": "white"
},
"xaxis2": {
"rangemode": "tozero",
"anchor": "y2",
"domain": [0.525, 1],
"gridcolor": "white"
},
"yaxis2": {
"anchor": "x2",
"domain": [0, 0.475],
"ticklabelposition": "inside",
"gridcolor": "white"
},
"xaxis3": {
"anchor": "y3",
"domain": [0.525, 1],
"ticklabelposition": "inside",
"gridcolor": "white"
},
"yaxis3": {
"rangemode": "nonnegative",
"anchor": "x3",
"domain": [0.525, 1],
"gridcolor": "white"
},
"xaxis4": {
"anchor": "y4",
"domain": [0, 0.475],
"ticklabelposition": "inside",
"gridcolor": "white"
},
"yaxis4": {
"rangemode": "tozero",
"anchor": "x4",
"domain": [0.525, 1],
"gridcolor": "white"
},
"font": {
"size": 20
},
"plot_bgcolor": "lightblue",
"showlegend": false,
"width": 800,
"height": 800,
"margin": {
"t": 40,
"b": 40,
"l": 40,
"r": 40
}
}
}

0 comments on commit 0b254e7

Please sign in to comment.