@ -431,10 +431,14 @@ nv.models.axis = function() {
//check if max and min overlap other values, if so, hide the values that overlap
if ( showMaxMin && ( axis . orient ( ) === 'left' || axis . orient ( ) === 'right' ) ) {
g . selectAll ( 'g' ) // the g's wrapping each tick
. filter ( function ( d , i ) {
return d && ( scale ( d ) < scale . range ( ) [ 1 ] + 10 || scale ( d ) > scale . range ( ) [ 0 ] - 10 ) ; // 10 is assuming text height is 16... if d is 0, leave it!
} )
. remove ( ) ;
. each ( function ( d , i ) {
if ( scale ( d ) < scale . range ( ) [ 1 ] + 10 || scale ( d ) > scale . range ( ) [ 0 ] - 10 ) { // 10 is assuming text height is 16... if d is 0, leave it!
if ( d > 1e-10 || d < - 1e-10 ) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
d3 . select ( this ) . remove ( ) ;
else
d3 . select ( this ) . select ( 'text' ) . remove ( ) ; // Don't remove the ZERO line!!
}
} ) ;
}
if ( showMaxMin && ( axis . orient ( ) === 'top' || axis . orient ( ) === 'bottom' ) ) {
@ -447,10 +451,14 @@ nv.models.axis = function() {
maxMinRange . push ( scale ( d ) + this . getBBox ( ) . width + 4 )
} ) ;
g . selectAll ( 'g' ) // the g's wrapping each tick
. filter ( function ( d , i ) {
return d && ( scale ( d ) < maxMinRange [ 0 ] || scale ( d ) > maxMinRange [ 1 ] ) ;
} )
. remove ( ) ;
. each ( function ( d , i ) {
if ( scale ( d ) < maxMinRange [ 0 ] || scale ( d ) > maxMinRange [ 1 ] ) {
if ( d > 1e-10 || d < - 1e-10 ) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
d3 . select ( this ) . remove ( ) ;
else
d3 . select ( this ) . select ( 'text' ) . remove ( ) ; // Don't remove the ZERO line!!
}
} ) ;
}
@ -1623,7 +1631,7 @@ nv.models.discreteBar = function() {
//.range([availableHeight, 0]);
if ( showValues ) y . range ( [ availableHeight - ( y . domain ( ) [ 0 ] < 0 ? 12 : 0 ) , y . domain ( ) [ 1 ] < 0 ? 0 : 12 ] ) ;
if ( showValues ) y . range ( [ availableHeight - ( y . domain ( ) [ 0 ] < 0 ? 12 : 0 ) , y . domain ( ) [ 1 ] > 0 ? 12 : 0 ] ) ;
else y . range ( [ availableHeight , 0 ] ) ;
//store old scales if they exist
@ -1864,7 +1872,7 @@ nv.models.discreteBar = function() {
}
nv . models . discreteBarChart = function ( ) {
var margin = { top : 30, right : 2 0, bottom : 50 , left : 60 } ,
var margin = { top : 10, right : 1 0, bottom : 50 , left : 60 } ,
width = null ,
height = null ,
color = d3 . scale . category20 ( ) . range ( ) ,
@ -1958,7 +1966,7 @@ nv.models.discreteBarChart = function() {
. tickSize ( - availableHeight , 0 ) ;
g . select ( '.x.axis' )
. attr ( 'transform' , 'translate(0,' + ( y . range ( ) [ 0 ] + ( discretebar . showValues ( ) ? 16 : 0 ) ) + ')' )
. attr ( 'transform' , 'translate(0,' + ( y . range ( ) [ 0 ] + ( ( discretebar . showValues ( ) && y . domain ( ) [ 0 ] < 0 ) ? 16 : 0 ) ) + ')' )
//d3.transition(g.select('.x.axis'))
g . select ( '.x.axis' ) . transition ( ) . duration ( 0 )
. call ( xAxis ) ;