@@ -162,8 +162,11 @@ function rolling_average(dates, requests, window = 28) {
162162 sum += requests [ j ] ;
163163 count ++ ;
164164 }
165- const average = count > 0 ? sum / count : 0 ;
166- result . push ( average ) ;
165+ if ( count > 0 ) {
166+ result . push ( 30.42 * sum / count ) ;
167+ } else {
168+ result . push ( null ) ;
169+ }
167170 }
168171 return result ;
169172}
@@ -195,7 +198,8 @@ function rolling_average(dates, requests, window = 28) {
195198 )
196199 var series = [ ]
197200 sorted_keys . map ( function ( key ) {
198- color_index = ( series . length / 2 ) % 10
201+ // color_index = (series.length / 2) % 10
202+ color_index = series . length % 10
199203 object = {
200204 x : data [ key ] [ "dates" ] ,
201205 y : rolling_average ( data [ key ] [ "dates" ] , data [ key ] [ "requests" ] ) ,
@@ -207,20 +211,20 @@ function rolling_average(dates, requests, window = 28) {
207211 object [ "visible" ] = "legendonly"
208212 }
209213 series . push ( object ) ;
210- object = {
211- x : data [ key ] [ "dates" ] ,
212- y : data [ key ] [ "requests" ] ,
213- name : key ,
214- mode : "markers" ,
215- type : "scatter" ,
216- marker : { opacity : 0.1 , color : defaultColors [ color_index ] } ,
217- legendgroup : key ,
218- showlegend : false ,
219- }
220- if ( ! visible . has ( key ) ) {
221- object [ "visible" ] = "legendonly"
222- }
223- series . push ( object ) ;
214+ // object = {
215+ // x: data[key]["dates"],
216+ // y: data[key]["requests"],
217+ // name: key,
218+ // mode: "markers",
219+ // type: "scatter",
220+ // marker: {opacity: 0.1, color: defaultColors[color_index]},
221+ // legendgroup: key,
222+ // showlegend: false,
223+ // }
224+ // if (!visible.has(key)) {
225+ // object["visible"] = "legendonly"
226+ // }
227+ // series.push(object);
224228 return
225229 } ) ;
226230 Plotly . plot (
@@ -231,7 +235,7 @@ function rolling_average(dates, requests, window = 28) {
231235 hovermode : 'closest' ,
232236 "yaxis" : {
233237 "range" : [ "2021-09-01" , to_date ( new Date ( ) ) ] ,
234- "title" : "Daily download count "
238+ "title" : "Downloads per month "
235239 }
236240 } ,
237241 ) ;
0 commit comments