Skip to content

Commit 944482c

Browse files
committed
add 'noCrisp' option to Axes.drawTicks and Axes.drawGrid
... to turn off crispEdge SVG rendering.
1 parent 219eb08 commit 944482c

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

src/plots/cartesian/axes.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ axes.drawTicks = function(gd, ax, opts) {
18051805
ticks.enter().append('path')
18061806
.classed(cls, 1)
18071807
.classed('ticks', 1)
1808-
.classed('crisp', 1)
1808+
.classed('crisp', !opts.noCrisp)
18091809
.call(Color.stroke, ax.tickcolor)
18101810
.style('stroke-width', Drawing.crispRound(gd, ax.tickwidth, 1) + 'px')
18111811
.attr('d', opts.path);
@@ -1825,7 +1825,7 @@ axes.drawGrid = function(gd, ax, opts) {
18251825

18261826
grid.enter().append('path')
18271827
.classed(cls, 1)
1828-
.classed('crisp', 1)
1828+
.classed('crisp', !opts.noCrisp)
18291829
.attr('d', opts.path)
18301830
.each(function(d) {
18311831
if(ax.zeroline && (ax.type === 'linear' || ax.type === '-') &&
@@ -1857,7 +1857,7 @@ axes.drawZeroLine = function(gd, ax, opts) {
18571857
zl.enter().append('path')
18581858
.classed(cls, 1)
18591859
.classed('zl', 1)
1860-
.classed('crisp', 1)
1860+
.classed('crisp', !opts.noCrisp)
18611861
.attr('d', opts.path)
18621862
.each(function() {
18631863
// use the fact that only one element can enter to trigger a sort.

src/plots/polar/polar.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,6 @@ proto.updateLayout = function(fullLayout, polarLayout) {
296296
.attr('d', dPath)
297297
.attr('transform', strTranslate(cx, cy))
298298
.call(Color.fill, polarLayout.bgcolor);
299-
300-
// remove crispEdges - all the off-square angles in polar plots
301-
// make these counterproductive.
302-
_this.framework.selectAll('.crisp').classed('crisp', 0);
303299
};
304300

305301
proto.mockAxis = function(fullLayout, polarLayout, axLayout, opts) {
@@ -420,14 +416,16 @@ proto.updateRadialAxis = function(fullLayout, polarLayout) {
420416
vals: vals,
421417
layer: layers['radial-axis'],
422418
path: Axes.makeTickPath(ax, 0, tickSign[2]),
423-
transFn: transFn
419+
transFn: transFn,
420+
noCrisp: true
424421
});
425422

426423
Axes.drawGrid(gd, ax, {
427424
vals: valsClipped,
428425
layer: layers['radial-grid'],
429426
path: gridPathFn,
430-
transFn: Lib.noop
427+
transFn: Lib.noop,
428+
noCrisp: true
431429
});
432430

433431
Axes.drawLabels(gd, ax, {
@@ -638,14 +636,16 @@ proto.updateAngularAxis = function(fullLayout, polarLayout) {
638636
vals: vals,
639637
layer: layers['angular-axis'],
640638
path: 'M' + (tickSign[2] * pad) + ',0h' + (tickSign[2] * ax.ticklen),
641-
transFn: transFn2
639+
transFn: transFn2,
640+
noCrisp: true
642641
});
643642

644643
Axes.drawGrid(gd, ax, {
645644
vals: vals,
646645
layer: layers['angular-grid'],
647646
path: gridPathFn,
648-
transFn: Lib.noop
647+
transFn: Lib.noop,
648+
noCrisp: true
649649
});
650650

651651
Axes.drawLabels(gd, ax, {

src/plots/ternary/ternary.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,6 @@ proto.adjustLayout = function(ternaryLayout, graphSize) {
323323

324324
_this.drawAxes(true);
325325

326-
// remove crispEdges - all the off-square angles in ternary plots
327-
// make these counterproductive.
328-
_this.plotContainer.selectAll('.crisp').classed('crisp', false);
329-
330326
_this.layers.aline.select('path')
331327
.attr('d', aaxis.showline ?
332328
'M' + x0 + ',' + (y0 + h) + 'l' + (w / 2) + ',-' + h : 'M0,0')
@@ -454,14 +450,16 @@ proto.drawAx = function(ax) {
454450
vals: ax.ticks === 'inside' ? valsClipped : vals,
455451
layer: axLayer,
456452
path: tickPath,
457-
transFn: transFn
453+
transFn: transFn,
454+
noCrisp: true
458455
});
459456

460457
Axes.drawGrid(gd, ax, {
461458
vals: valsClipped,
462459
layer: _this.layers[axLetter + 'grid'],
463460
path: gridPath,
464-
transFn: transFn
461+
transFn: transFn,
462+
noCrisp: true
465463
});
466464

467465
var labelFns = Axes.makeLabelFns(ax, 0, counterAngle);
@@ -731,7 +729,6 @@ proto.initInteractions = function() {
731729
_this.caxis.range = [_this.sum - mins.a - mins.b, mins.c];
732730

733731
_this.drawAxes(false);
734-
_this.plotContainer.selectAll('.crisp').classed('crisp', false);
735732

736733
if(_this._hasClipOnAxisFalse) {
737734
_this.plotContainer

0 commit comments

Comments
 (0)