@@ -142,13 +142,10 @@ angular.module('chartInitializer')
142142 var finalMax = Math . max . apply ( Math , [ mapAxis . max [ i ] , plotBands && plotBands [ 0 ] . to != plotBands [ 0 ] . from ? plotBands [ 0 ] . to : mapAxis . max [ i ] , plotLines && plotLines [ 0 ] . width > 0 ? plotLines [ 0 ] . value : mapAxis . max [ i ] ] . map ( function ( o ) { return o ; } ) ) ;
143143
144144 if ( chartConf . yAxis [ i ] . min === undefined || chartConf . yAxis [ i ] . min == 'auto' ) {
145- chartConf . yAxis [ i ] . min = finalMin >= 0 ? finalMin * 0.5 : finalMin * 1.5 ;
145+ chartConf . yAxis [ i ] . min = finalMin > 0 ? finalMin * 0.5 : ( finalMin < 0 ? finalMin * 1.5 : null ) ;
146146 }
147- finalMin = chartConf . yAxis [ i ] . min ;
148- if ( chartConf . yAxis [ i ] . min == "" ) chartConf . yAxis [ i ] . min = null ;
149147 if ( chartConf . yAxis [ i ] . max === undefined || chartConf . yAxis [ i ] . max == 'auto' ) {
150- chartConf . yAxis [ i ] . max = finalMax >= 0 ? finalMax * 1.1 : finalMax * 0.9 ;
151-
148+ chartConf . yAxis [ i ] . max = finalMax > 0 ? finalMax * 1.1 : ( finalMax < 0 ? finalMax * 0.9 : null ) ;
152149 }
153150 finalMax = chartConf . yAxis [ i ] . max
154151 if ( chartConf . yAxis [ i ] . max == "" ) chartConf . yAxis [ i ] . max = null ;
@@ -619,9 +616,13 @@ angular.module('chartInitializer')
619616 }
620617 }
621618
622- var maxData = Math . max . apply ( Math , series . data . map ( function ( o ) { if ( o . y ) { return o . y ; } else { return null } } ) ) ;
623- if ( maxData < 0 ) maxData = 0 ;
624- var minData = Math . min . apply ( Math , series . data . map ( function ( o ) { if ( o . y ) { return o . y ; } else { return null } } ) ) ;
619+ var maxData = Math . max . apply ( Math , series . data . map ( function ( o ) {
620+ return ( o . y !== undefined && o . y !== null ) ? o . y : null ;
621+ } ) ) ;
622+ if ( maxData < 0 ) maxData = 0 ;
623+ var minData = Math . min . apply ( Math , series . data . map ( function ( o ) {
624+ return ( o . y !== undefined && o . y !== null ) ? o . y : null ;
625+ } ) ) ;
625626
626627 var minDrill = Math . min . apply ( Math , [ minData , chart . extremes [ indexOfAxis ] . plotBands && chart . extremes [ indexOfAxis ] . plotBands [ 0 ] . from != chart . extremes [ indexOfAxis ] . plotBands [ 0 ] . to ? chart . extremes [ indexOfAxis ] . plotBands [ 0 ] . from : minData , chart . extremes [ indexOfAxis ] . plotLines && chart . extremes [ indexOfAxis ] . plotLines [ 0 ] . width > 0 ? chart . extremes [ indexOfAxis ] . plotLines [ 0 ] . value : minData ] . map ( function ( o ) { return o ; } ) ) ;
627628 var maxDrill = Math . max . apply ( Math , [ maxData , chart . extremes [ indexOfAxis ] . plotBands && chart . extremes [ indexOfAxis ] . plotBands [ 0 ] . to != chart . extremes [ indexOfAxis ] . plotBands [ 0 ] . from ? chart . extremes [ indexOfAxis ] . plotBands [ 0 ] . to : maxData , chart . extremes [ indexOfAxis ] . plotLines && chart . extremes [ indexOfAxis ] . plotLines [ 0 ] . width > 0 ? chart . extremes [ indexOfAxis ] . plotLines [ 0 ] . value : maxData ] . map ( function ( o ) { return o ; } ) ) ;
@@ -894,15 +895,14 @@ angular.module('chartInitializer')
894895
895896 if ( this . chart . options . chart . type == "pie" ) {
896897 for ( var i = 0 ; i < newData . length ; i ++ ) {
898+ counter = 0 ; // ← reset qui
897899 for ( var j = 0 ; j < newData [ i ] . length ; j ++ ) {
898-
899900 if ( newData [ i ] [ j ] . y == 0 ) {
900901 counter ++
901902 }
902903 }
903904 if ( counter == newData [ i ] . length ) {
904905 newData [ i ] = [ ] ;
905- counter = 0 ;
906906 }
907907 }
908908 }
0 commit comments