@@ -365,7 +365,7 @@ angular.module('app')
365
365
} ) ( index ) ;
366
366
}
367
367
368
- this . lineGraph = function ( module , options ) {
368
+ this . versionGraph = function ( module , options ) {
369
369
var width = options . width - margin . left - margin . right ;
370
370
371
371
var dataStore = module . time ;
@@ -479,11 +479,19 @@ angular.module('app')
479
479
// Position circle at correct y-position
480
480
. attr ( "cy" , function ( d ) { return height - d . majorVersion * 100 } )
481
481
// Size and color of circle based on update 'importance'
482
- . attr ( "r" , function ( d ) { return ( d . majorVersion + 1 ) > 0 ? ( d . majorVersion + 5 ) : 5 } )
482
+ . attr ( "r" , function ( d ) { return 0 } )
483
483
. attr ( "fill" , function ( d ) { return '#' + colorScale ( d . majorVersion ) } )
484
484
. attr ( "opacity" , 0.7 )
485
485
. on ( 'mouseover' , tip . show )
486
486
. on ( 'mouseout' , tip . hide )
487
+
488
+ var transit = d3 . select ( '#graph-container' ) . select ( 'svg' )
489
+ . selectAll ( 'circle' )
490
+ . data ( data )
491
+ . transition ( )
492
+ . duration ( 1000 )
493
+ . attr ( "r" , function ( d ) { return ( d . majorVersion + 1 ) > 0 ? ( d . majorVersion + 5 ) : 5 } )
494
+
487
495
}
488
496
489
497
// Render the download graph
@@ -584,15 +592,32 @@ angular.module('app')
584
592
. enter ( ) . append ( "rect" )
585
593
. attr ( "class" , "bar" )
586
594
. attr ( "x" , function ( d ) { return x ( dateFormat . parse ( d . day ) ) ; } )
587
- . attr ( "y" , function ( d ) { return y ( d . count ) ; } )
588
- . attr ( "height" , function ( d ) { return height - y ( d . count ) ; } )
595
+ . attr ( "y" , function ( d ) { return height ; } )
596
+ . attr ( "height" , function ( d ) { return 0 } )
589
597
. attr ( "width" , options . barWidth )
590
-
591
- chart . append ( 'path' )
592
- . attr ( "class" , "moving-average" )
593
- . attr ( 'd' , line ( data ) )
594
- . attr ( 'fill-opacity' , 0 )
595
- // });
598
+
599
+ var transit = d3 . select ( '#graph-container' ) . select ( 'svg' )
600
+ . selectAll ( 'rect' )
601
+ . data ( data )
602
+ . transition ( )
603
+ . duration ( 1000 )
604
+ . attr ( "y" , function ( d ) { return y ( d . count ) ; } )
605
+ . attr ( "height" , function ( d ) { return height - y ( d . count ) ; } )
606
+
607
+ setTimeout ( function ( ) {
608
+ var path = chart . append ( 'path' )
609
+ . attr ( "class" , "moving-average" )
610
+ . attr ( 'd' , line ( data ) )
611
+ . attr ( 'fill' , 'none' )
612
+
613
+ var totalLength = path . node ( ) . getTotalLength ( ) ;
614
+
615
+ path . attr ( 'stroke-dasharray' , totalLength + ' ' + totalLength )
616
+ . attr ( 'stroke-dashoffset' , totalLength )
617
+ . transition ( )
618
+ . duration ( 2000 )
619
+ . ease ( 'linear' )
620
+ . attr ( 'stroke-dashoffset' , 0 ) ; } , 500 )
596
621
597
622
function type ( d ) {
598
623
d . count = + d . count ; // coerce to number
0 commit comments