Skip to content

Commit 66c9d87

Browse files
committed
delete minor when no minor ticks or gridlines
1 parent 1db3524 commit 66c9d87

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/plots/cartesian/axes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2766,7 +2766,7 @@ axes.getTickSigns = function(ax, minor) {
27662766
var out = [-1, 1, main, -main];
27672767
// then we flip if outside XOR y axis
27682768

2769-
var ticks = minor ? ax.minor.ticks : ax.ticks;
2769+
var ticks = minor ? (ax.minor || {}).ticks : ax.ticks;
27702770
if((ticks !== 'inside') === (axLetter === 'x')) {
27712771
out = out.map(function(v) { return -v; });
27722772
}
@@ -2878,6 +2878,8 @@ function getTickLabelUV(ax) {
28782878
axes.makeTickPath = function(ax, shift, sgn, opts) {
28792879
if(!opts) opts = {};
28802880
var minor = opts.minor;
2881+
if(minor && !ax.minor) return '';
2882+
28812883
var len = opts.len !== undefined ? opts.len :
28822884
minor ? ax.minor.ticklen : ax.ticklen;
28832885

src/plots/cartesian/axis_defaults.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
151151
attributes: layoutAttributes
152152
});
153153

154+
// delete minor when no minor ticks or gridlines
155+
if(
156+
hasMinor &&
157+
!containerOut.minor.ticks &&
158+
!containerOut.minor.showgrid
159+
) {
160+
delete containerOut.minor;
161+
}
162+
154163
// mirror
155164
if(containerOut.showline || containerOut.ticks) coerce('mirror');
156165

0 commit comments

Comments
 (0)