Skip to content

Commit 863854f

Browse files
committed
fix lint warnings
1 parent 8f53e11 commit 863854f

File tree

3 files changed

+44
-50
lines changed

3 files changed

+44
-50
lines changed

src/components/drawing/index.js

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -377,21 +377,21 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, scale, s
377377
var path = '';
378378
switch(shape) {
379379
case '/':
380-
width = baseSize * Math.sqrt(2);
380+
width = baseSize * Math.sqrt(2);
381381
height = baseSize * Math.sqrt(2);
382382
path = 'M-1,1l2,-2' +
383383
'M0,' + height + 'L' + width + ',0' +
384384
'M' + (width - 1) + ',' + (height + 1) + 'l2,-2';
385385
break;
386386
case '\\':
387-
width = baseSize * Math.sqrt(2);
387+
width = baseSize * Math.sqrt(2);
388388
height = baseSize * Math.sqrt(2);
389389
path = 'M' + (width - 1) + ',-1l2,2' +
390390
'M0,0L' + width + ',' + height +
391391
'M-1,' + (height - 1) + 'l2,2';
392392
break;
393393
case 'x':
394-
width = baseSize * Math.sqrt(2);
394+
width = baseSize * Math.sqrt(2);
395395
height = baseSize * Math.sqrt(2);
396396
path = 'M-1,1l2,-2' +
397397
'M0,' + height + 'L' + width + ',0' +
@@ -401,29 +401,23 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, scale, s
401401
'M-1,' + (height - 1) + 'l2,2';
402402
break;
403403
case '|':
404-
width = baseSize;
404+
width = baseSize;
405405
height = baseSize;
406406
path = 'M' + (width / 2) + ',0L' + (width / 2) + ',' + height;
407407
break;
408408
case '-':
409-
width = baseSize;
409+
width = baseSize;
410410
height = baseSize;
411411
path = 'M0,' + (height / 2) + 'L' + width + ',' + (height / 2);
412412
break;
413413
case '+':
414-
width = baseSize;
415-
height = baseSize;
416-
path = 'M' + (width / 2) + ',0L' + (width / 2) + ',' + height +
417-
'M0,' + (height / 2) + 'L' + width + ',' + (height / 2);
418-
break;
419-
case '+':
420-
width = baseSize;
414+
width = baseSize;
421415
height = baseSize;
422416
path = 'M' + (width / 2) + ',0L' + (width / 2) + ',' + height +
423417
'M0,' + (height / 2) + 'L' + width + ',' + (height / 2);
424418
break;
425419
case '.':
426-
width = baseSize;
420+
width = baseSize;
427421
height = baseSize;
428422
break;
429423
}
@@ -440,10 +434,10 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, scale, s
440434
var el = d3.select(this);
441435

442436
el.attr({
443-
'id' : fullID,
444-
'width' : width + 'px',
445-
'height' : height + 'px',
446-
'patternUnits' : 'userSpaceOnUse'
437+
'id': fullID,
438+
'width': width + 'px',
439+
'height': height + 'px',
440+
'patternUnits': 'userSpaceOnUse'
447441
});
448442

449443
var rects = el.selectAll('rect').data([0]);
@@ -452,40 +446,40 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, scale, s
452446
rects.enter()
453447
.append('rect')
454448
.attr({
455-
'width' : width + 'px',
456-
'height' : height + 'px',
457-
'fill' : bgcolor
449+
'width': width + 'px',
450+
'height': height + 'px',
451+
'fill': bgcolor
458452
});
459453
}
460454

461-
if(shape == '.') {
455+
if(shape === '.') {
462456
var circles = el.selectAll('circle').data([0]);
463457
circles.exit().remove();
464458
circles.enter()
465459
.append('circle')
466460
.attr({
467-
'cx' : width / 2,
468-
'cy' : height / 2,
469-
'r' : solidity,
470-
'fill' : fgcolor
461+
'cx': width / 2,
462+
'cy': height / 2,
463+
'r': solidity,
464+
'fill': fgcolor
471465
});
472466
} else {
473467
var paths = el.selectAll('path').data([0]);
474468
paths.exit().remove();
475469
paths.enter()
476470
.append('path')
477471
.attr({
478-
'd' : path,
479-
'stroke' : fgcolor,
480-
'stroke-width' : solidity + 'px'
472+
'd': path,
473+
'stroke': fgcolor,
474+
'stroke-width': solidity + 'px'
481475
});
482476
}
483477
});
484478

485479
sel.style(prop, getFullUrl(fullID, gd))
486480
.style(prop + '-opacity', null);
487481

488-
sel.classed("pattern_filled", true);
482+
sel.classed('pattern_filled', true);
489483
var className2query = function(s) {
490484
return '.' + s.attr('class').replace(/\s/g, '.');
491485
};
@@ -632,14 +626,14 @@ drawing.singlePointStyle = function(d, sel, trace, fns, gd) {
632626
}
633627

634628
var getPatternAttr = function(mp, i, dflt) {
635-
if (mp && Array.isArray(mp)) {
636-
if (i < mp.length) return mp[i];
637-
else return dflt;
629+
if(mp && Array.isArray(mp)) {
630+
if(i < mp.length) return mp[i];
631+
else return dflt;
638632
}
639633
return mp;
640634
};
641635
var markerPattern = marker.patternfill;
642-
var patternShape = markerPattern && getPatternAttr(markerPattern.shape, d.i, '');
636+
var patternShape = markerPattern && getPatternAttr(markerPattern.shape, d.i, '');
643637

644638
if(gradientType && gradientType !== 'none') {
645639
var gradientColor = d.mgc;
@@ -652,13 +646,13 @@ drawing.singlePointStyle = function(d, sel, trace, fns, gd) {
652646
drawing.gradient(sel, gd, gradientID, gradientType,
653647
[[0, gradientColor], [1, fillColor]], 'fill');
654648
} else if(patternShape) {
655-
var patternBGColor = getPatternAttr(markerPattern.bgcolor , d.i, null);
656-
var patternScale = getPatternAttr(markerPattern.scale , d.i, 1);
657-
var patternSolidity = getPatternAttr(markerPattern.solidity, d.i, 1);
658-
var perPointPattern = Array.isArray(markerPattern.shape) ||
659-
Array.isArray(markerPattern.bgcolor) ||
660-
Array.isArray(markerPattern.scale) ||
661-
Array.isArray(markerPattern.solidity);
649+
var patternBGColor = getPatternAttr(markerPattern.bgcolor, d.i, null);
650+
var patternScale = getPatternAttr(markerPattern.scale, d.i, 1);
651+
var patternSolidity = getPatternAttr(markerPattern.solidity, d.i, 1);
652+
var perPointPattern = Array.isArray(markerPattern.shape) ||
653+
Array.isArray(markerPattern.bgcolor) ||
654+
Array.isArray(markerPattern.scale) ||
655+
Array.isArray(markerPattern.solidity);
662656

663657
var patternID = trace.uid;
664658
if(perPointPattern) patternID += '-' + d.i;

src/components/legend/style.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -362,20 +362,20 @@ module.exports = function style(s, gd, legend) {
362362
var fillColor = d0.mc || marker.color;
363363

364364
var getPatternAttr = function(mp, dflt) {
365-
if (mp && Array.isArray(mp)) {
366-
if (mp.length > 0) return mp[0];
367-
else return dflt;
365+
if(mp && Array.isArray(mp)) {
366+
if(mp.length > 0) return mp[0];
367+
else return dflt;
368368
}
369369
return mp;
370370
};
371371
var markerPattern = marker.patternfill;
372-
var patternShape = markerPattern && getPatternAttr(markerPattern.shape, '');
372+
var patternShape = markerPattern && getPatternAttr(markerPattern.shape, '');
373373

374374
if(patternShape) {
375-
var patternBGColor = getPatternAttr(markerPattern.bgcolor , null);
376-
var patternScale = getPatternAttr(markerPattern.scale , 1);
375+
var patternBGColor = getPatternAttr(markerPattern.bgcolor, null);
376+
var patternScale = getPatternAttr(markerPattern.scale, 1);
377377
var patternSolidity = getPatternAttr(markerPattern.solidity, 1);
378-
var patternID = trace.uid;
378+
var patternID = trace.uid;
379379
p.call(Drawing.pattern, gd, patternID, patternShape, patternBGColor,
380380
fillColor, patternScale, patternSolidity, 'fill');
381381
} else {

src/snapshot/tosvg.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = function toSVG(gd, format, scale) {
3333
var toppaper = fullLayout._toppaper;
3434
var width = fullLayout.width;
3535
var height = fullLayout.height;
36-
var i;
36+
var i, k;
3737

3838
// make background color a rect in the svg, then revert after scraping
3939
// all other alterations have been dealt with by properly preparing the svg
@@ -108,11 +108,11 @@ module.exports = function toSVG(gd, format, scale) {
108108

109109
var queryParts = [];
110110
if(fullLayout._gradientUrlQueryParts) {
111-
for(var k in fullLayout._gradientUrlQueryParts) queryParts.push(k);
111+
for(k in fullLayout._gradientUrlQueryParts) queryParts.push(k);
112112
}
113113

114114
if(fullLayout._patternUrlQueryParts) {
115-
for(var k in fullLayout._patternUrlQueryParts) queryParts.push(k);
115+
for(k in fullLayout._patternUrlQueryParts) queryParts.push(k);
116116
}
117117

118118
if(queryParts.length) {

0 commit comments

Comments
 (0)