@ -1925,9 +1925,14 @@
colors = _colors ,
pattern = notEmpty ( _pattern ) ? _pattern : [ '#1f77b4' , '#ff7f0e' , '#2ca02c' , '#d62728' , '#9467bd' , '#8c564b' , '#e377c2' , '#7f7f7f' , '#bcbd22' , '#17becf' ] ; //same as d3.scale.category10()
return function ( id ) {
return function ( d ) {
var id = d . id || d ;
// if callback function is provided
if ( colors [ id ] instanceof Function ) { return colors [ id ] ( d ) ; }
// if specified, choose that color
if ( id in colors ) { return _colors [ id ] ; }
if ( id in colors ) { return colors [ id ] ; }
// if not specified, choose from pattern
if ( ids . indexOf ( id ) === - 1 ) {
@ -2008,7 +2013,7 @@
. attr ( "class" , function ( ) { return generateClass ( CLASS . selectedCircle , i ) ; } )
. attr ( "cx" , _ _axis _rotated ? circleY : circleX )
. attr ( "cy" , _ _axis _rotated ? circleX : circleY )
. attr ( "stroke" , function ( ) { return color ( d . id ) ; } )
. attr ( "stroke" , function ( ) { return color ( d ) ; } )
. attr ( "r" , _ _point _select _r * 1.4 )
. transition ( ) . duration ( 100 )
. attr ( "r" , _ _point _select _r ) ;
@ -2026,11 +2031,11 @@
function selectBar ( target , d ) {
_ _data _onselected ( d , target . node ( ) ) ;
target . transition ( ) . duration ( 100 ) . style ( "fill" , function ( ) { return d3 . rgb ( color ( d . id ) ) . darker ( 1 ) ; } ) ;
target . transition ( ) . duration ( 100 ) . style ( "fill" , function ( ) { return d3 . rgb ( color ( d ) ) . darker ( 1 ) ; } ) ;
}
function unselectBar ( target , d ) {
_ _data _onunselected ( d , target . node ( ) ) ;
target . transition ( ) . duration ( 100 ) . style ( "fill" , function ( ) { return color ( d . id ) ; } ) ;
target . transition ( ) . duration ( 100 ) . style ( "fill" , function ( ) { return color ( d ) ; } ) ;
}
function toggleBar ( selected , target , d , i ) {
selected ? selectBar ( target , d , i ) : unselectBar ( target , d , i ) ;
@ -3072,7 +3077,7 @@
. attr ( 'd' , drawBar )
. style ( "stroke" , 'none' )
. style ( "opacity" , 0 )
. style ( "fill" , function ( d ) { return color ( d . id ) ; } )
. style ( "fill" , function ( d ) { return color ( d ) ; } )
. attr ( "class" , classBar ) ;
mainBar
. style ( "opacity" , initialOpacity )
@ -3182,7 +3187,7 @@
contextBar . enter ( ) . append ( 'path' )
. attr ( 'd' , drawBarOnSub )
. style ( "stroke" , 'none' )
. style ( "fill" , function ( d ) { return color ( d . id ) ; } )
. style ( "fill" , function ( d ) { return color ( d ) ; } )
. attr ( "class" , classBar ) ;
contextBar
. style ( "opacity" , initialOpacity )
@ -3363,7 +3368,7 @@
. style ( "pointer-events" , "none" ) ;
mainTextEnter . append ( 'g' )
. attr ( 'class' , classTexts )
. style ( "fill" , function ( d ) { return color ( d . id ) ; } ) ;
. style ( "fill" , function ( d ) { return color ( d ) ; } ) ;
//-- Bar --//
mainBarUpdate = main . select ( '.' + CLASS . chartBars )
@ -3375,7 +3380,7 @@
// Bars for each data
mainBarEnter . append ( 'g' )
. attr ( "class" , classBars )
. style ( "fill" , function ( d ) { return color ( d . id ) ; } )
. style ( "fill" , function ( d ) { return color ( d ) ; } )
. style ( "stroke" , "none" )
. style ( "cursor" , function ( d ) { return _ _data _selection _isselectable ( d ) ? "pointer" : null ; } ) ;
@ -3390,18 +3395,18 @@
mainLineEnter . append ( "path" )
. attr ( "class" , classLine )
. style ( "opacity" , 0 )
. style ( "stroke" , function ( d ) { return color ( d . id ) ; } ) ;
. style ( "stroke" , function ( d ) { return color ( d ) ; } ) ;
// Areas
mainLineEnter . append ( "path" )
. attr ( "class" , classArea )
. style ( "opacity" , function ( ) { orgAreaOpacity = + d3 . select ( this ) . style ( 'opacity' ) ; return 0 ; } )
. style ( "fill" , function ( d ) { return color ( d . id ) ; } ) ;
. style ( "fill" , function ( d ) { return color ( d ) ; } ) ;
// Circles for each data point on lines
mainLineEnter . append ( 'g' )
. attr ( "class" , function ( d ) { return generateClass ( CLASS . selectedCircles , d . id ) ; } ) ;
mainLineEnter . append ( 'g' )
. attr ( "class" , classCircles )
. style ( "fill" , function ( d ) { return color ( d . id ) ; } )
. style ( "fill" , function ( d ) { return color ( d ) ; } )
. style ( "cursor" , function ( d ) { return _ _data _selection _isselectable ( d ) ? "pointer" : null ; } ) ;
// Update date for selected circles
targets . forEach ( function ( t ) {
@ -3421,7 +3426,7 @@
mainPieEnter . append ( "path" )
. attr ( "class" , classArc )
. style ( "opacity" , 0 )
. style ( "fill" , function ( d ) { return color ( d . data . id ) ; } )
. style ( "fill" , function ( d ) { return color ( d . data ) ; } )
. style ( "cursor" , function ( d ) { return _ _data _selection _isselectable ( d ) ? "pointer" : null ; } )
. each ( function ( d ) { this . _current = d ; } )
. on ( 'mouseover' , function ( d , i ) {
@ -3465,7 +3470,7 @@
// Bars for each data
contextBarEnter . append ( 'g' )
. attr ( "class" , classBars )
. style ( "fill" , function ( d ) { return color ( d . id ) ; } ) ;
. style ( "fill" , function ( d ) { return color ( d ) ; } ) ;
//-- Line --//
contextLineUpdate = context . select ( '.' + CLASS . chartLines )
@ -3477,7 +3482,7 @@
contextLineEnter . append ( "path" )
. attr ( "class" , classLine )
. style ( "opacity" , 0 )
. style ( "stroke" , function ( d ) { return color ( d . id ) ; } ) ;
. style ( "stroke" , function ( d ) { return color ( d ) ; } ) ;
}
/*-- Show --*/