Skip to content

Commit

Permalink
only skip prefix and suffix for D log axes - improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Jul 22, 2019
1 parent 62c5854 commit 27067a6
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ axes.calcTicks = function calcTicks(ax) {
Math.min(ax._categories.length - 0.5, endTick);
}

var isLog = (ax.type === 'log');
var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');

var xPrevious = null;
var maxTicks = Math.max(1000, ax._length || 0);
Expand All @@ -590,7 +590,7 @@ axes.calcTicks = function calcTicks(ax) {
xPrevious = x;

var minor = false;
if(isLog && (x !== (x | 0))) {
if(isDLog && (x !== (x | 0))) {
minor = true;
}

Expand Down
Binary file modified test/image/baselines/log-axis_no-minor_suffix-prefix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 101 additions & 8 deletions test/image/mocks/log-axis_no-minor_suffix-prefix.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,111 @@
1e7
],
"type": "scatter"
},
{
"xaxis": "x2",
"yaxis": "y2",
"y": [
1e8,
1e6,
1e7
],
"type": "scatter"
},
{
"xaxis": "x3",
"yaxis": "y3",
"y": [
1e8,
1e6,
1e7
],
"type": "scatter"
},
{
"xaxis": "x4",
"yaxis": "y4",
"y": [
1e8,
1e6,
1e7
],
"type": "scatter"
}
],
"layout": {
"width": 800,
"height": 800,
"xaxis": {
"domain": [
0,
0.45
]
},
"xaxis2": {
"anchor": "y2",
"domain": [
0.6,
1
]
},
"xaxis3": {
"anchor": "y3",
"domain": [
0,
0.45
]
},
"xaxis4": {
"anchor": "y4",
"domain": [
0.6,
1
]
},
"yaxis": {
"type": "log",
"tickprefix": "$",
"ticksuffix": "Hz"
},
"height": 600,
"width": 300,
"margin": {
"l": 150
"tick0": 1,
"dtick": "L10000000",
"type": "log",
"tickprefix": "$",
"ticksuffix": "Hz",
"domain": [
0,
0.45
]
},
"yaxis2": {
"tick0": 1,
"dtick": 0.5,
"type": "log",
"tickprefix": "$",
"ticksuffix": "Hz",
"anchor": "x2",
"domain": [
0,
0.45
]
},
"yaxis3": {
"dtick": "D1",
"type": "log",
"tickprefix": "$",
"ticksuffix": "Hz",
"anchor": "x3",
"domain": [
0.6,
1
]
},
"yaxis4": {
"type": "log",
"tickprefix": "$",
"ticksuffix": "Hz",
"anchor": "x4",
"domain": [
0.6,
1
]
}
}
}

0 comments on commit 27067a6

Please sign in to comment.