File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed
Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -89,14 +89,21 @@ export default function interval (chart: Chart) {
8989 . attr ( 'fill' , 'none' )
9090
9191 // enter + update
92- innerSelection . merge ( innerSelectionEnter )
92+ const selection = innerSelection . merge ( innerSelectionEnter )
9393 . attr ( 'stroke-width' , minWidthHeight )
9494 . attr ( 'stroke' , utils . color ( d , index ) as any )
9595 . attr ( 'opacity' , closed ? 0.5 : 1 )
9696 . attr ( 'd' , function ( d : Interval [ ] [ ] ) {
9797 return line ( d , closed )
9898 } )
99- . attr ( d . attr )
99+
100+ if ( d . attr ) {
101+ for ( let k in d . attr ) {
102+ if ( d . attr . hasOwnProperty ( k ) ) {
103+ selection . attr ( k , d . attr [ k ] )
104+ }
105+ }
106+ }
100107
101108 innerSelection . exit ( ) . remove ( )
102109 } )
Original file line number Diff line number Diff line change @@ -79,7 +79,9 @@ export default function polyline (chart: Chart) {
7979
8080 if ( d . attr ) {
8181 for ( let k in d . attr ) {
82- path . attr ( k , d . attr [ k ] )
82+ if ( d . attr . hasOwnProperty ( k ) ) {
83+ path . attr ( k , d . attr [ k ] )
84+ }
8385 }
8486 }
8587 } )
Original file line number Diff line number Diff line change @@ -34,14 +34,21 @@ export default function scatter (chart: Chart) {
3434 const innerSelectionEnter = innerSelection . enter ( )
3535 . append ( 'circle' )
3636
37- innerSelection . merge ( innerSelectionEnter )
37+ const selection = innerSelection . merge ( innerSelectionEnter )
3838 . attr ( 'fill' , d3Hsl ( color . toString ( ) ) . brighter ( 1.5 ) . hex ( ) )
3939 . attr ( 'stroke' , color )
4040 . attr ( 'opacity' , 0.7 )
4141 . attr ( 'r' , 1 )
4242 . attr ( 'cx' , function ( d ) { return xScale ( d [ 0 ] ) } )
43- . attr ( 'cy' , function ( d ) { return yScale ( d [ 1 ] ) } )
44- . attr ( d . attr )
43+ . attr ( 'cy' , function ( d ) { return yScale ( d [ 1 ] ) } ) ;
44+
45+ if ( d . attr ) {
46+ for ( let k in d . attr ) {
47+ if ( d . attr . hasOwnProperty ( k ) ) {
48+ selection . attr ( k , d . attr [ k ] )
49+ }
50+ }
51+ }
4552
4653 innerSelection . exit ( ) . remove ( )
4754 } )
You can’t perform that action at this time.
0 commit comments