Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 27067a6

Browse files
committedJul 22, 2019
only skip prefix and suffix for D log axes - improve test
1 parent 62c5854 commit 27067a6

File tree

3 files changed

+103
-10
lines changed

3 files changed

+103
-10
lines changed
 

‎src/plots/cartesian/axes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ axes.calcTicks = function calcTicks(ax) {
577577
Math.min(ax._categories.length - 0.5, endTick);
578578
}
579579

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

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

592592
var minor = false;
593-
if(isLog && (x !== (x | 0))) {
593+
if(isDLog && (x !== (x | 0))) {
594594
minor = true;
595595
}
596596

Loading

‎test/image/mocks/log-axis_no-minor_suffix-prefix.json

Lines changed: 101 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,111 @@
77
1e7
88
],
99
"type": "scatter"
10+
},
11+
{
12+
"xaxis": "x2",
13+
"yaxis": "y2",
14+
"y": [
15+
1e8,
16+
1e6,
17+
1e7
18+
],
19+
"type": "scatter"
20+
},
21+
{
22+
"xaxis": "x3",
23+
"yaxis": "y3",
24+
"y": [
25+
1e8,
26+
1e6,
27+
1e7
28+
],
29+
"type": "scatter"
30+
},
31+
{
32+
"xaxis": "x4",
33+
"yaxis": "y4",
34+
"y": [
35+
1e8,
36+
1e6,
37+
1e7
38+
],
39+
"type": "scatter"
1040
}
1141
],
1242
"layout": {
43+
"width": 800,
44+
"height": 800,
45+
"xaxis": {
46+
"domain": [
47+
0,
48+
0.45
49+
]
50+
},
51+
"xaxis2": {
52+
"anchor": "y2",
53+
"domain": [
54+
0.6,
55+
1
56+
]
57+
},
58+
"xaxis3": {
59+
"anchor": "y3",
60+
"domain": [
61+
0,
62+
0.45
63+
]
64+
},
65+
"xaxis4": {
66+
"anchor": "y4",
67+
"domain": [
68+
0.6,
69+
1
70+
]
71+
},
1372
"yaxis": {
14-
"type": "log",
15-
"tickprefix": "$",
16-
"ticksuffix": "Hz"
17-
},
18-
"height": 600,
19-
"width": 300,
20-
"margin": {
21-
"l": 150
73+
"tick0": 1,
74+
"dtick": "L10000000",
75+
"type": "log",
76+
"tickprefix": "$",
77+
"ticksuffix": "Hz",
78+
"domain": [
79+
0,
80+
0.45
81+
]
82+
},
83+
"yaxis2": {
84+
"tick0": 1,
85+
"dtick": 0.5,
86+
"type": "log",
87+
"tickprefix": "$",
88+
"ticksuffix": "Hz",
89+
"anchor": "x2",
90+
"domain": [
91+
0,
92+
0.45
93+
]
94+
},
95+
"yaxis3": {
96+
"dtick": "D1",
97+
"type": "log",
98+
"tickprefix": "$",
99+
"ticksuffix": "Hz",
100+
"anchor": "x3",
101+
"domain": [
102+
0.6,
103+
1
104+
]
105+
},
106+
"yaxis4": {
107+
"type": "log",
108+
"tickprefix": "$",
109+
"ticksuffix": "Hz",
110+
"anchor": "x4",
111+
"domain": [
112+
0.6,
113+
1
114+
]
22115
}
23116
}
24117
}

0 commit comments

Comments
 (0)
Please sign in to comment.