@@ -2876,7 +2876,7 @@ describe('bar tweening', function() {
2876
2876
data : [ {
2877
2877
type : 'bar' ,
2878
2878
x : [ 'A' , 'B' , 'C' ] ,
2879
- y : [ null , 5 , 3 ] ,
2879
+ y : [ null , 5 , 3 , 4 ] ,
2880
2880
marker : {
2881
2881
line : {
2882
2882
width : 10
@@ -2931,6 +2931,87 @@ describe('bar tweening', function() {
2931
2931
. catch ( failTest )
2932
2932
. then ( done ) ;
2933
2933
} ) ;
2934
+
2935
+ it ( 'handle NaN positions on vertical bars' , function ( done ) {
2936
+ var y1 = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ;
2937
+ var y2 = [ 10 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 ] ;
2938
+ var mockCopy = {
2939
+ data : [
2940
+ {
2941
+ type : 'bar' ,
2942
+ x : [
2943
+ 0 ,
2944
+ 1 ,
2945
+ '' ,
2946
+ 'NaN' ,
2947
+ NaN ,
2948
+ Infinity ,
2949
+ - Infinity ,
2950
+ undefined ,
2951
+ null ,
2952
+ 9
2953
+ ] ,
2954
+ y : y1
2955
+ }
2956
+ ] ,
2957
+ layout : {
2958
+ width : 400 ,
2959
+ height : 300
2960
+ }
2961
+ } ;
2962
+
2963
+ var tests = [
2964
+ [ 0 , '.point path' , 'attr' , 'd' , [ 'M2,120V109H22V120Z' , 'M26,120V97H46V120Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M218,120V6H238V120Z' ] ] ,
2965
+ [ 300 , '.point path' , 'attr' , 'd' , [ 'M2,120V47H22V120Z' , 'M26,120V49H46V120Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M218,120V68H238V120Z' ] ] ,
2966
+ [ 600 , '.point path' , 'attr' , 'd' , [ 'M2,120V6H22V120Z' , 'M26,120V17H46V120Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M218,120V109H238V120Z' ] ]
2967
+ ] ;
2968
+ var animateOpts = { data : [ { y : y2 } ] } ;
2969
+
2970
+ checkTransition ( gd , mockCopy , animateOpts , transitionOpts , tests )
2971
+ . catch ( failTest )
2972
+ . then ( done ) ;
2973
+ } ) ;
2974
+
2975
+ it ( 'handle NaN positions on horizontal bars' , function ( done ) {
2976
+ var x1 = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ;
2977
+ var x2 = [ 10 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 ] ;
2978
+ var mockCopy = {
2979
+ data : [
2980
+ {
2981
+ type : 'bar' ,
2982
+ orientation : 'h' ,
2983
+ y : [
2984
+ 0 ,
2985
+ 1 ,
2986
+ '' ,
2987
+ 'NaN' ,
2988
+ NaN ,
2989
+ Infinity ,
2990
+ - Infinity ,
2991
+ undefined ,
2992
+ null ,
2993
+ 9
2994
+ ] ,
2995
+ x : x1
2996
+ }
2997
+ ] ,
2998
+ layout : {
2999
+ width : 400 ,
3000
+ height : 300
3001
+ }
3002
+ } ;
3003
+
3004
+ var tests = [
3005
+ [ 0 , '.point path' , 'attr' , 'd' , [ 'M0,119V109H23V119Z' , 'M0,107V97H46V107Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,11V1H228V11Z' ] ] ,
3006
+ [ 300 , '.point path' , 'attr' , 'd' , [ 'M0,119V109H146V119Z' , 'M0,107V97H141V107Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,11V1H105V11Z' ] ] ,
3007
+ [ 600 , '.point path' , 'attr' , 'd' , [ 'M0,119V109H228V119Z' , 'M0,107V97H205V107Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,0Z' , 'M0,11V1H23V11Z' ] ]
3008
+ ] ;
3009
+ var animateOpts = { data : [ { x : x2 } ] } ;
3010
+
3011
+ checkTransition ( gd , mockCopy , animateOpts , transitionOpts , tests )
3012
+ . catch ( failTest )
3013
+ . then ( done ) ;
3014
+ } ) ;
2934
3015
} ) ;
2935
3016
2936
3017
describe ( 'bar uniformtext' , function ( ) {
0 commit comments