@@ -377,21 +377,21 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, scale, s
377
377
var path = '' ;
378
378
switch ( shape ) {
379
379
case '/' :
380
- width = baseSize * Math . sqrt ( 2 ) ;
380
+ width = baseSize * Math . sqrt ( 2 ) ;
381
381
height = baseSize * Math . sqrt ( 2 ) ;
382
382
path = 'M-1,1l2,-2' +
383
383
'M0,' + height + 'L' + width + ',0' +
384
384
'M' + ( width - 1 ) + ',' + ( height + 1 ) + 'l2,-2' ;
385
385
break ;
386
386
case '\\' :
387
- width = baseSize * Math . sqrt ( 2 ) ;
387
+ width = baseSize * Math . sqrt ( 2 ) ;
388
388
height = baseSize * Math . sqrt ( 2 ) ;
389
389
path = 'M' + ( width - 1 ) + ',-1l2,2' +
390
390
'M0,0L' + width + ',' + height +
391
391
'M-1,' + ( height - 1 ) + 'l2,2' ;
392
392
break ;
393
393
case 'x' :
394
- width = baseSize * Math . sqrt ( 2 ) ;
394
+ width = baseSize * Math . sqrt ( 2 ) ;
395
395
height = baseSize * Math . sqrt ( 2 ) ;
396
396
path = 'M-1,1l2,-2' +
397
397
'M0,' + height + 'L' + width + ',0' +
@@ -401,29 +401,23 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, scale, s
401
401
'M-1,' + ( height - 1 ) + 'l2,2' ;
402
402
break ;
403
403
case '|' :
404
- width = baseSize ;
404
+ width = baseSize ;
405
405
height = baseSize ;
406
406
path = 'M' + ( width / 2 ) + ',0L' + ( width / 2 ) + ',' + height ;
407
407
break ;
408
408
case '-' :
409
- width = baseSize ;
409
+ width = baseSize ;
410
410
height = baseSize ;
411
411
path = 'M0,' + ( height / 2 ) + 'L' + width + ',' + ( height / 2 ) ;
412
412
break ;
413
413
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 ;
421
415
height = baseSize ;
422
416
path = 'M' + ( width / 2 ) + ',0L' + ( width / 2 ) + ',' + height +
423
417
'M0,' + ( height / 2 ) + 'L' + width + ',' + ( height / 2 ) ;
424
418
break ;
425
419
case '.' :
426
- width = baseSize ;
420
+ width = baseSize ;
427
421
height = baseSize ;
428
422
break ;
429
423
}
@@ -440,10 +434,10 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, scale, s
440
434
var el = d3 . select ( this ) ;
441
435
442
436
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'
447
441
} ) ;
448
442
449
443
var rects = el . selectAll ( 'rect' ) . data ( [ 0 ] ) ;
@@ -452,40 +446,40 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, scale, s
452
446
rects . enter ( )
453
447
. append ( 'rect' )
454
448
. attr ( {
455
- 'width' : width + 'px' ,
456
- 'height' : height + 'px' ,
457
- 'fill' : bgcolor
449
+ 'width' : width + 'px' ,
450
+ 'height' : height + 'px' ,
451
+ 'fill' : bgcolor
458
452
} ) ;
459
453
}
460
454
461
- if ( shape == '.' ) {
455
+ if ( shape === '.' ) {
462
456
var circles = el . selectAll ( 'circle' ) . data ( [ 0 ] ) ;
463
457
circles . exit ( ) . remove ( ) ;
464
458
circles . enter ( )
465
459
. append ( 'circle' )
466
460
. 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
471
465
} ) ;
472
466
} else {
473
467
var paths = el . selectAll ( 'path' ) . data ( [ 0 ] ) ;
474
468
paths . exit ( ) . remove ( ) ;
475
469
paths . enter ( )
476
470
. append ( 'path' )
477
471
. attr ( {
478
- 'd' : path ,
479
- 'stroke' : fgcolor ,
480
- 'stroke-width' : solidity + 'px'
472
+ 'd' : path ,
473
+ 'stroke' : fgcolor ,
474
+ 'stroke-width' : solidity + 'px'
481
475
} ) ;
482
476
}
483
477
} ) ;
484
478
485
479
sel . style ( prop , getFullUrl ( fullID , gd ) )
486
480
. style ( prop + '-opacity' , null ) ;
487
481
488
- sel . classed ( " pattern_filled" , true ) ;
482
+ sel . classed ( ' pattern_filled' , true ) ;
489
483
var className2query = function ( s ) {
490
484
return '.' + s . attr ( 'class' ) . replace ( / \s / g, '.' ) ;
491
485
} ;
@@ -632,14 +626,14 @@ drawing.singlePointStyle = function(d, sel, trace, fns, gd) {
632
626
}
633
627
634
628
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 ;
638
632
}
639
633
return mp ;
640
634
} ;
641
635
var markerPattern = marker . patternfill ;
642
- var patternShape = markerPattern && getPatternAttr ( markerPattern . shape , d . i , '' ) ;
636
+ var patternShape = markerPattern && getPatternAttr ( markerPattern . shape , d . i , '' ) ;
643
637
644
638
if ( gradientType && gradientType !== 'none' ) {
645
639
var gradientColor = d . mgc ;
@@ -652,13 +646,13 @@ drawing.singlePointStyle = function(d, sel, trace, fns, gd) {
652
646
drawing . gradient ( sel , gd , gradientID , gradientType ,
653
647
[ [ 0 , gradientColor ] , [ 1 , fillColor ] ] , 'fill' ) ;
654
648
} 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 ) ;
662
656
663
657
var patternID = trace . uid ;
664
658
if ( perPointPattern ) patternID += '-' + d . i ;
0 commit comments