@ -2,6 +2,7 @@
var nv = window . nv || { } ;
nv . version = '1.1.1b' ;
nv . dev = true //set false when in production
@ -4764,6 +4765,7 @@ nv.models.indentedTree = function() {
columnWidths [ seriesPerRow ] = seriesWidths [ seriesPerRow ] ;
legendWidth += seriesWidths [ seriesPerRow ++ ] ;
}
if ( seriesPerRow === 0 ) seriesPerRow = 1 ; //minimum of one series per row
while ( legendWidth > availableWidth && seriesPerRow > 1 ) {
@ -6482,6 +6484,10 @@ nv.models.lineWithFocusChart = function() {
brushExtent = brush . empty ( ) ? null : brush . extent ( ) ;
extent = brush . empty ( ) ? x2 . domain ( ) : brush . extent ( ) ;
//The brush extent cannot be less than one. If it is, don't update the line chart.
if ( Math . abs ( extent [ 0 ] - extent [ 1 ] ) <= 1 ) {
return ;
}
dispatch . brush ( { extent : extent , brush : brush } ) ;
@ -10004,6 +10010,7 @@ nv.models.pie = function() {
, showLabels = true
, pieLabelsOutside = true
, donutLabelsOutside = false
, labelType = "key"
, labelThreshold = . 02 //if slice percentage is under this, don't show label
, donut = false
, labelSunbeamLayout = false
@ -10199,7 +10206,12 @@ nv.models.pie = function() {
. style ( 'text-anchor' , labelSunbeamLayout ? ( ( d . startAngle + d . endAngle ) / 2 < Math . PI ? 'start' : 'end' ) : 'middle' ) //center the text on it's origin or begin/end if orthogonal aligned
. text ( function ( d , i ) {
var percent = ( d . endAngle - d . startAngle ) / ( 2 * Math . PI ) ;
return ( d . value && percent > labelThreshold ) ? getX ( d . data ) : '' ;
var labelTypes = {
"key" : getX ( d . data ) ,
"value" : getY ( d . data ) ,
"percent" : d3 . format ( '%' ) ( percent )
} ;
return ( d . value && percent > labelThreshold ) ? labelTypes [ labelType ] : '' ;
} ) ;
var textBox = slice . select ( 'text' ) . node ( ) . getBBox ( ) ;
@ -10318,6 +10330,13 @@ nv.models.pie = function() {
return chart ;
} ;
chart . labelType = function ( _ ) {
if ( ! arguments . length ) return labelType ;
labelType = _ ;
labelType = labelType || "key" ;
return chart ;
} ;
chart . donut = function ( _ ) {
if ( ! arguments . length ) return donut ;
donut = _ ;
@ -10612,7 +10631,7 @@ nv.models.pieChart = function() {
chart . dispatch = dispatch ;
chart . pie = pie ;
d3 . rebind ( chart , pie , 'valueFormat' , 'values' , 'x' , 'y' , 'description' , 'id' , 'showLabels' , 'donutLabelsOutside' , 'pieLabelsOutside' , ' donut', 'donutRatio' , 'labelThreshold' ) ;
d3 . rebind ( chart , pie , 'valueFormat' , 'values' , 'x' , 'y' , 'description' , 'id' , 'showLabels' , 'donutLabelsOutside' , 'pieLabelsOutside' , ' labelType', ' donut', 'donutRatio' , 'labelThreshold' ) ;
chart . margin = function ( _ ) {
if ( ! arguments . length ) return margin ;