11'use strict' ;
22
33var d3 = require ( '@plotly/d3' ) ;
4+ var Lib = require ( '../../lib' ) ;
45
56var Drawing = require ( '../../components/drawing' ) ;
67var Color = require ( '../../components/color' ) ;
@@ -11,16 +12,20 @@ function style(gd) {
1112
1213 s . each ( function ( d ) {
1314 var trace = d [ 0 ] . trace ;
14- var line = trace . line || { } ;
15+ var marker = trace . marker || { } ;
16+ var markerLine = marker . line || { } ;
17+ var lineColor = Lib . isArrayOrTypedArray ( marker . color ) ? undefined : marker . color ;
1518
1619 d3 . select ( this ) . selectAll ( 'path.js-line' )
17- . call ( Drawing . lineGroupStyle , line . width , line . color , line . dash ) ;
20+ . call ( Drawing . lineGroupStyle , markerLine . width , lineColor , markerLine . dash ) ;
1821 } ) ;
1922}
2023
2124function styleOnSelect ( gd , cd , sel ) {
2225 var trace = cd [ 0 ] . trace ;
23- var line = trace . line || { } ;
26+ var marker = trace . marker || { } ;
27+ var markerLine = marker . line || { } ;
28+ var lineColor = Lib . isArrayOrTypedArray ( marker . color ) ? undefined : marker . color ;
2429
2530 if ( ! sel ) return ;
2631
@@ -34,24 +39,24 @@ function styleOnSelect(gd, cd, sel) {
3439 var path = d3 . select ( this ) ;
3540
3641 if ( d . selected ) {
37- var sc = selectedLine . color || line . color ;
38- var sw = selectedLine . width !== undefined ? selectedLine . width : line . width ;
39- Drawing . lineGroupStyle ( path , sw , sc , line . dash ) ;
42+ var sc = selectedLine . color || lineColor ;
43+ var sw = selectedLine . width !== undefined ? selectedLine . width : markerLine . width ;
44+ Drawing . lineGroupStyle ( path , sw , sc , markerLine . dash ) ;
4045 } else {
4146 var uc = unselectedLine . color ;
4247 var uw = unselectedLine . width ;
4348 if ( ! uc ) {
44- uc = line . color ? Color . addOpacity ( line . color , DESELECTDIM ) : undefined ;
49+ uc = lineColor ? Color . addOpacity ( lineColor , DESELECTDIM ) : undefined ;
4550 }
46- if ( uw === undefined ) uw = line . width ;
47- Drawing . lineGroupStyle ( path , uw , uc , line . dash ) ;
51+ if ( uw === undefined ) uw = markerLine . width ;
52+ Drawing . lineGroupStyle ( path , uw , uc , markerLine . dash ) ;
4853 }
4954 } ) ;
5055
5156 Drawing . selectedTextStyle ( sel . selectAll ( 'text' ) , trace ) ;
5257 } else {
5358 sel . selectAll ( 'path.js-line' )
54- . call ( Drawing . lineGroupStyle , line . width , line . color , line . dash ) ;
59+ . call ( Drawing . lineGroupStyle , markerLine . width , lineColor , markerLine . dash ) ;
5560 Drawing . textPointStyle ( sel . selectAll ( 'text' ) , trace , gd ) ;
5661 }
5762}
0 commit comments