@@ -34,7 +34,7 @@ function draw_line_repoActivity(areaID, repoNameWOwner) {
3434 element = document . querySelector ( '.' + areaID ) . parentNode ,
3535 containerWidth = element . offsetWidth ,
3636 width = containerWidth - margin . left - margin . right ,
37- height = Math . max ( containerWidth / 3 , 400 ) - margin . top - margin . bottom ;
37+ height = Math . max ( containerWidth / 3 , 400 ) - margin . top - margin . bottom ;
3838 var dotRadius = stdDotRadius ;
3939
4040 var x = d3
@@ -86,7 +86,7 @@ function draw_line_repoActivity(areaID, repoNameWOwner) {
8686 }
8787 return '<sub>[Week of ' + formatTime ( d . date ) + ']</sub>' + '<br>' + d . value + repos ;
8888 } ) ;
89-
89+
9090 var pieTip = d3
9191 . tip ( )
9292 . attr ( 'class' , 'd3-tip' )
@@ -96,14 +96,8 @@ function draw_line_repoActivity(areaID, repoNameWOwner) {
9696 } ) ;
9797
9898 var dToday = x . domain ( ) [ 1 ] ;
99- // Supercomputing
100- var dSupercomp = '11-18' ;
101- // Thanksgiving
102- var dThnxgiv = '11-25' ;
103- // Christmas
104- var dXmas = '12-25' ;
105-
106- function update ( x , y ) {
99+
100+ function update ( x , y ) {
107101 chart . selectAll ( 'g' ) . remove ( ) ;
108102
109103 var xAxis = d3 . axisBottom ( ) . scale ( x ) ;
@@ -187,9 +181,15 @@ function draw_line_repoActivity(areaID, repoNameWOwner) {
187181 . attr ( 'd' , valueline ) ;
188182
189183 // Draw date-of-interest reference lines
190- addDateLine ( dSupercomp , 'Supercomputing' ) ;
191- addDateLine ( dThnxgiv , 'Thanksgiving' ) ;
192- addDateLine ( dXmas , 'Christmas' ) ;
184+ var annotationDates = {
185+ 'Supercomputing' : '11-18' ,
186+ 'Thanksgiving' : '11-25' ,
187+ 'Christmas' : '12-25'
188+ } ;
189+ for ( var annotationName in annotationDates ) {
190+ var annotationDate = annotationDates [ annotationName ] ;
191+ addDateLine ( annotationDate , annotationName ) ;
192+ }
193193
194194 // Draw dots
195195 chart
@@ -269,7 +269,7 @@ function draw_line_repoActivity(areaID, repoNameWOwner) {
269269
270270 // Colors used for coloring the pie chart
271271 const colors = d3 . scaleSequential ( d3 . interpolate ( 'lightblue' , 'white' ) ) . domain ( [ 0 , root . descendants ( ) . length ] ) ;
272-
272+
273273 // Equivalent of chart but for the pie chart
274274 const pieGroup = chart
275275 . append ( 'g' )
0 commit comments