@@ -384,6 +384,8 @@ $.elycharts.templates = {
384
384
startAngle : 0 ,
385
385
// Disegna la torta con le fette in senso orario (invece dell'orientamento standard per gradi, in senso antiorario)
386
386
clockwise : false ,
387
+ // Soglia (rapporto sul totale) entro la quale una fetta non viene visualizzata
388
+ valueThresold : 0.006 ,
387
389
388
390
defaultSeries : {
389
391
// r: .5, raggio usato solo per questo spicchio, se <=1 e' in rapporto al raggio generale
@@ -591,7 +593,7 @@ function _normalizeOptionsColor($options, $section) {
591
593
592
594
if ( ! $section . plotProps )
593
595
$section . plotProps = { } ;
594
- if ( $section . type == 'line' ) {
596
+ if ( $section . type == 'line' || ( $options . type == 'line' && ! $section . type ) ) {
595
597
if ( $section . plotProps && ! $section . plotProps . stroke )
596
598
$section . plotProps . stroke = color ;
597
599
} else {
@@ -613,7 +615,7 @@ function _normalizeOptionsColor($options, $section) {
613
615
if ( $section . legend . dotProps && ! $section . legend . dotProps . fill )
614
616
$section . legend . dotProps . fill = color ;
615
617
616
- if ( $options . type == 'line' && $section . type == 'line' ) {
618
+ if ( $options . type == 'line' && ( $section . type == 'line' || ! $section . type ) ) {
617
619
if ( ! $section . dotProps )
618
620
$section . dotProps = { } ;
619
621
if ( $section . dotProps && ! $section . dotProps . fill )
@@ -688,6 +690,9 @@ $.elycharts.common = {
688
690
var flag = ( a2 - a1 ) > 180 ;
689
691
a1 = ( a1 % 360 ) * Math . PI / 180 ;
690
692
a2 = ( a2 % 360 ) * Math . PI / 180 ;
693
+ // Se i due angoli risultano uguali ma inizialmente erano diversi significa che c'e' un giro intero (es: 0-360), che va rappresentato
694
+ if ( a1 == a2 && aa1 != aa2 )
695
+ a2 += 359.99 * Math . PI / 180 ;
691
696
692
697
return { path : rint ? [
693
698
[ "M" , cx + r * Math . cos ( a1 ) , cy + r * Math . sin ( a1 ) ] ,
@@ -910,7 +915,7 @@ $.elycharts.common = {
910
915
}
911
916
path . push ( [ "C" , anc [ 0 ] , anc [ 1 ] , points [ jj ] [ 0 ] , points [ jj ] [ 1 ] , points [ jj ] [ 0 ] , points [ jj ] [ 1 ] ] ) ;
912
917
913
- path = this . linepathRevert ( path ) ;
918
+ // path = this.linepathRevert(path);
914
919
915
920
} else {
916
921
var path = [ ] ;
@@ -1606,10 +1611,18 @@ $.elycharts.anchormanager = {
1606
1611
afterShow : function ( env , pieces ) {
1607
1612
// Prendo le aree gestite da mouseAreas, e metto i miei listener
1608
1613
// Non c'e' bisogno di gestire il clean per una chiamata successiva, lo fa gia' il mouseareamanager
1609
- // TODO Pero' l'unbind precedente andrebbe fatto, e come fa ora fa l'unbind anche di funzioni non nostre
1614
+ // Tranne per i bind degli eventi jquery
1610
1615
1611
1616
if ( ! env . opt . anchors )
1612
1617
return ;
1618
+
1619
+ if ( ! env . anchorBinds )
1620
+ env . anchorBinds = [ ] ;
1621
+
1622
+ while ( env . anchorBinds . length ) {
1623
+ var b = env . anchorBinds . pop ( ) ;
1624
+ $ ( b [ 0 ] ) . unbind ( b [ 1 ] , b [ 2 ] ) ;
1625
+ }
1613
1626
1614
1627
for ( var i = 0 ; i < env . mouseAreas . length ; i ++ ) {
1615
1628
var serie = env . mouseAreas [ i ] . piece ? env . mouseAreas [ i ] . piece . serie : false ;
@@ -1621,15 +1634,19 @@ $.elycharts.anchormanager = {
1621
1634
if ( anc && env . mouseAreas [ i ] . props . anchor && env . mouseAreas [ i ] . props . anchor . highlight ) {
1622
1635
1623
1636
( function ( env , mouseAreaData , anc , caller ) {
1624
- // TODO Dovrebbe fare l'unbind solo delle sue funzioni
1625
- $ ( anc ) . unbind ( ) ;
1626
1637
1638
+ var f1 = function ( ) { caller . anchorMouseOver ( env , mouseAreaData ) ; } ;
1639
+ var f2 = function ( ) { caller . anchorMouseOut ( env , mouseAreaData ) ; } ;
1627
1640
if ( ! env . mouseAreas [ i ] . props . anchor . useMouseEnter ) {
1628
- $ ( anc ) . mouseover ( function ( ) { caller . anchorMouseOver ( env , mouseAreaData ) ; } ) ;
1629
- $ ( anc ) . mouseout ( function ( ) { caller . anchorMouseOut ( env , mouseAreaData ) ; } ) ;
1641
+ env . anchorBinds . push ( [ anc , 'mouseover' , f1 ] ) ;
1642
+ env . anchorBinds . push ( [ anc , 'mouseout' , f2 ] ) ;
1643
+ $ ( anc ) . mouseover ( f1 ) ;
1644
+ $ ( anc ) . mouseout ( f2 ) ;
1630
1645
} else {
1631
- $ ( anc ) . mouseenter ( function ( ) { caller . anchorMouseOver ( env , mouseAreaData ) ; } ) ;
1632
- $ ( anc ) . mouseleave ( function ( ) { caller . anchorMouseOut ( env , mouseAreaData ) ; } ) ;
1646
+ env . anchorBinds . push ( [ anc , 'mouseenter' , f1 ] ) ;
1647
+ env . anchorBinds . push ( [ anc , 'mouseleave' , f2 ] ) ;
1648
+ $ ( anc ) . mouseenter ( f1 ) ;
1649
+ $ ( anc ) . mouseleave ( f2 ) ;
1633
1650
}
1634
1651
} ) ( env , env . mouseAreas [ i ] , anc , this ) ;
1635
1652
}
@@ -2989,7 +3006,7 @@ $.elycharts.tooltipmanager = {
2989
3006
return ;
2990
3007
2991
3008
if ( ! env . opt . tooltips || ( serie && ( ! env . opt . tooltips [ serie ] || ! env . opt . tooltips [ serie ] [ index ] ) ) || ( ! serie && ! env . opt . tooltips [ index ] ) )
2992
- return this . hide ( env , serie , index , mouseAreaData , props ) ;
3009
+ return this . onMouseExit ( env , serie , index , mouseAreaData ) ;
2993
3010
2994
3011
var tip = serie ? env . opt . tooltips [ serie ] [ index ] : env . opt . tooltips [ index ] ;
2995
3012
@@ -3010,7 +3027,7 @@ $.elycharts.tooltipmanager = {
3010
3027
return ;
3011
3028
3012
3029
if ( ! env . opt . tooltips || ( serie && ( ! env . opt . tooltips [ serie ] || ! env . opt . tooltips [ serie ] [ index ] ) ) || ( ! serie && ! env . opt . tooltips [ index ] ) )
3013
- return this . hide ( env , serie , index , mouseAreaData , props ) ;
3030
+ return this . onMouseExit ( env , serie , index , mouseAreaData ) ;
3014
3031
3015
3032
var tip = serie ? env . opt . tooltips [ serie ] [ index ] : env . opt . tooltips [ index ] ;
3016
3033
@@ -3490,7 +3507,6 @@ $.elycharts.line = {
3490
3507
pieces . push ( { section : 'Series' , serie : serie , subSection : 'Dot' , path : false , attr : false } ) ;
3491
3508
}
3492
3509
}
3493
-
3494
3510
featuresmanager . beforeShow ( env , pieces ) ;
3495
3511
common . show ( env , pieces ) ;
3496
3512
featuresmanager . afterShow ( env , pieces ) ;
@@ -3716,7 +3732,7 @@ $.elycharts.pie = {
3716
3732
plot . total += plot . values [ i ] ;
3717
3733
}
3718
3734
for ( var i = 0 ; i < ii ; i ++ )
3719
- if ( plot . values [ i ] < plot . total * 0.006 ) {
3735
+ if ( plot . values [ i ] < plot . total * opt . valueThresold ) {
3720
3736
plot . total = plot . total - plot . values [ i ] ;
3721
3737
plot . values [ i ] = 0 ;
3722
3738
}
0 commit comments