@ -85,13 +85,15 @@ describe('c3 chart data', function () {
"112" : [ "600" ] ,
"112" : [ "600" ] ,
"223" : [ { "224" : "100" } ] ,
"223" : [ { "224" : "100" } ] ,
"334" : [ [ ] , [ { "335" : "300" } ] ] ,
"334" : [ [ ] , [ { "335" : "300" } ] ] ,
"556" : { "557" : { "558" : [ "1000" ] } }
"556" : { "557" : { "558" : [ "1000" ] } } ,
"778.889" : "700"
} , {
} , {
"date" : "2014-06-04" ,
"date" : "2014-06-04" ,
"443" : "1000" ,
"443" : "1000" ,
"112" : [ "700" ] ,
"112" : [ "700" ] ,
"223" : [ { "224" : "200" } ] ,
"223" : [ { "224" : "200" } ] ,
"556" : { "557" : { "558" : [ "2000" ] } }
"556" : { "557" : { "558" : [ "2000" ] } } ,
"778.889" : "300"
} , {
} , {
"date" : "2014-06-05" ,
"date" : "2014-06-05" ,
"995" : { "996" : "1000" } ,
"995" : { "996" : "1000" } ,
@ -99,11 +101,12 @@ describe('c3 chart data', function () {
"223" : [ { "224" : "300" } ] ,
"223" : [ { "224" : "300" } ] ,
"443" : "5000" ,
"443" : "5000" ,
"334" : [ [ ] , [ { "335" : "500" } ] ] ,
"334" : [ [ ] , [ { "335" : "500" } ] ] ,
"556" : { "557" : { "558" : [ "3000" ] } }
"556" : { "557" : { "558" : [ "3000" ] } } ,
"778.889" : "800"
} ] ,
} ] ,
keys : {
keys : {
x : 'date' ,
x : 'date' ,
value : [ "443" , "995.996" , "112[0]" , "223[0].224" , "334[1][0].335" , "556.557.558[0]" ]
value : [ "443" , "995.996" , "112[0]" , "223[0].224" , "334[1][0].335" , "556.557.558[0]" , "778.889" ]
}
}
} ,
} ,
axis : {
axis : {
@ -118,12 +121,13 @@ describe('c3 chart data', function () {
it ( 'should draw nested JSON correctly' , function ( ) {
it ( 'should draw nested JSON correctly' , function ( ) {
var expectedCx = [ 98 , 294 , 490 ] ,
var expectedCx = [ 98 , 294 , 490 ] ,
expectedCy = {
expectedCy = {
443 : [ 181 , 326 , 36 ] ,
"443" : [ 181 , 326 , 36 ] ,
995 : [ 362 , 398 , 326 ] ,
"995" : [ 362 , 398 , 326 ] ,
112 : [ 354 , 347 , 340 ] ,
"112" : [ 354 , 347 , 340 ] ,
223 : [ 391 , 383 , 376 ] ,
"223" : [ 391 , 383 , 376 ] ,
334 : [ 376 , 398 , 362 ] ,
"334" : [ 376 , 398 , 362 ] ,
556 : [ 326 , 253 , 181 ]
"556" : [ 326 , 253 , 181 ] ,
"778.889" : [ 347 , 376 , 340 ]
} ;
} ;
d3 . selectAll ( '.c3-circles-443 .c3-circle' ) . each ( function ( d , i ) {
d3 . selectAll ( '.c3-circles-443 .c3-circle' ) . each ( function ( d , i ) {
@ -161,6 +165,12 @@ describe('c3 chart data', function () {
expect ( + circle . attr ( 'cx' ) ) . toBeCloseTo ( expectedCx [ i ] , 0 ) ;
expect ( + circle . attr ( 'cx' ) ) . toBeCloseTo ( expectedCx [ i ] , 0 ) ;
expect ( + circle . attr ( 'cy' ) ) . toBeCloseTo ( expectedCy [ 556 ] [ i ] , 0 ) ;
expect ( + circle . attr ( 'cy' ) ) . toBeCloseTo ( expectedCy [ 556 ] [ i ] , 0 ) ;
} ) ;
} ) ;
d3 . selectAll ( '.c3-circles-778-889 .c3-circle' ) . each ( function ( d , i ) {
var circle = d3 . select ( this ) ;
expect ( + circle . attr ( 'cx' ) ) . toBeCloseTo ( expectedCx [ i ] , 0 ) ;
expect ( + circle . attr ( 'cy' ) ) . toBeCloseTo ( expectedCy [ "778.889" ] [ i ] , 0 ) ;
} ) ;
} ) ;
} ) ;
} ) ;
} ) ;