Skip to content

Commit 7afdb78

Browse files
committed
reduce crispRound calls for minor
1 parent 51813f9 commit 7afdb78

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/plots/cartesian/axes.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,8 +3123,10 @@ axes.drawGrid = function(gd, ax, opts) {
31233123

31243124
var cls = ax._id + 'grid';
31253125

3126+
var hasMinor = ax.minor && ax.minor.showgrid;
3127+
31263128
var vals = []
3127-
.concat(ax.minor && ax.minor.showgrid ?
3129+
.concat(hasMinor ?
31283130
// minor vals
31293131
opts.vals.filter(function(d) { return d.minor; }) :
31303132
[]
@@ -3162,6 +3164,9 @@ axes.drawGrid = function(gd, ax, opts) {
31623164

31633165
ax._gw = Drawing.crispRound(gd, ax.gridwidth, 1);
31643166

3167+
var wMinor;
3168+
if(hasMinor) wMinor = Drawing.crispRound(gd, ax.minor.gridwidth, 1);
3169+
31653170
grid.attr('transform', opts.transFn)
31663171
.attr('d', opts.path)
31673172
.each(function(d) {
@@ -3177,10 +3182,7 @@ axes.drawGrid = function(gd, ax, opts) {
31773182
);
31783183
})
31793184
.style('stroke-width', function(d) {
3180-
return (d.minor ?
3181-
Drawing.crispRound(gd, ax.minor.gridwidth, 1) :
3182-
ax._gw
3183-
) + 'px';
3185+
return (d.minor ? wMinor : ax._gw) + 'px';
31843186
})
31853187
.style('display', null); // visible
31863188

0 commit comments

Comments
 (0)