@ -12437,30 +12437,34 @@ nv.models.stackedArea = function() {
// Injecting point index into each point because d3.layout.stack().out does not give index
// ***Also storing getY(d,i) as stackedY so that it can be set to 0 if series is disabled
data = data . map ( function ( aseries , i ) {
aseries . seriesIndex = i ;
aseries . values = aseries . values . map ( function ( d , j ) {
d . index = j ;
d . s tackedY = aseries . disabled ? 0 : getY ( d , j ) ;
d . s eriesIndex = i ;
return d ;
} )
return aseries ;
} ) ;
var dataFiltered = data . filter ( function ( series ) {
return ! series . disabled ;
} ) ;
data = d3 . layout . stack ( )
. order ( order )
. offset ( offset )
. values ( function ( d ) { return d . values } ) //TODO: make values customizeable in EVERY model in this fashion
. x ( getX )
. y ( function ( d ) { return d . stackedY } )
. y ( getY )
. out ( function ( d , y0 , y ) {
d . display = {
y : y ,
y0 : y0
} ;
var yHeight = ( getY ( d ) === 0 ) ? 0 : y ;
d . display = {
y : yHeight ,
y0 : y0
} ;
} )
( data ) ;
( data Filtered ) ;
//------------------------------------------------------------
@ -12487,12 +12491,12 @@ nv.models.stackedArea = function() {
. y ( function ( d ) { return d . display . y + d . display . y0 } )
. forceY ( [ 0 ] )
. color ( data . map ( function ( d , i ) {
return d . color || color ( d , i) ;
} ) .filter ( function ( d , i ) { return ! data [ i ] . disabled } ) );
return d . color || color ( d , d. ser iesIndex ) ;
} ) );
var scatterWrap = g . select ( '.nv-scatterWrap' )
. datum ( data .filter ( function ( d ) { return ! d . disabled } ) )
. datum ( data );
//d3.transition(scatterWrap).call(scatter);
scatterWrap . call ( scatter ) ;
@ -12516,8 +12520,12 @@ nv.models.stackedArea = function() {
var area = d3 . svg . area ( )
. x ( function ( d , i ) { return x ( getX ( d , i ) ) } )
. y0 ( function ( d ) { return y ( d . display . y0 ) } )
. y1 ( function ( d ) { return y ( d . display . y + d . display . y0 ) } )
. y0 ( function ( d ) {
return y ( d . display . y0 )
} )
. y1 ( function ( d ) {
return y ( d . display . y + d . display . y0 )
} )
. interpolate ( interpolate ) ;
var zeroArea = d3 . svg . area ( )
@ -12527,7 +12535,9 @@ nv.models.stackedArea = function() {
var path = g . select ( '.nv-areaWrap' ) . selectAll ( 'path.nv-area' )
. data ( function ( d ) { return d } ) ;
. data ( function ( d ) {
return d
} ) ;
//.data(function(d) { return d }, function(d) { return d.key });
path . enter ( ) . append ( 'path' ) . attr ( 'class' , function ( d , i ) { return 'nv-area nv-area-' + i } )
. on ( 'mouseover' , function ( d , i ) {
@ -12562,11 +12572,15 @@ nv.models.stackedArea = function() {
. attr ( 'd' , function ( d , i ) { return zeroArea ( d . values , i ) } )
. remove ( ) ;
path
. style ( 'fill' , function ( d , i ) { return d . color || color ( d , i ) } )
. style ( 'stroke' , function ( d , i ) { return d . color || color ( d , i ) } ) ;
. style ( 'fill' , function ( d , i ) {
return d . color || color ( d , d . seriesIndex )
} )
. style ( 'stroke' , function ( d , i ) { return d . color || color ( d , d . seriesIndex ) } ) ;
//d3.transition(path)
path
. attr ( 'd' , function ( d , i ) { return area ( d . values , i ) } )
. attr ( 'd' , function ( d , i ) {
return area ( d . values , i )
} )
//============================================================
@ -12757,12 +12771,6 @@ nv.models.stackedAreaChart = function() {
yAxis
. orient ( ( rightAlignYAxis ) ? 'right' : 'left' )
;
stacked . scatter
. pointActive ( function ( d ) {
//console.log(stacked.y()(d), !!Math.round(stacked.y()(d) * 100));
return ! ! Math . round ( stacked . y ( ) ( d ) * 100 ) ;
} )
;
//============================================================