Ero sivun ”Widget:Test4” versioiden välillä
Järvi-meriwikistä
Rivi 684: | Rivi 684: | ||
} | } | ||
} | } | ||
− | + | ||
+ | for ( var w=0; w<(memo.avgWA.length); w++ ) { | ||
+ | memo.avgWA[ w ].running3 = memo.avgWA[ w ].avg; | ||
+ | memo.avgWA[ w ].running5 = memo.avgWA[ w ].avg; | ||
+ | } | ||
+ | |||
+ | // make running average of 3 week averages | ||
+ | for ( var w=1; w<(memo.avgWA.length-1); w++ ) { | ||
+ | memo.avgWA[ w ].running3 = ( memo.avgWA[ w-1 ].sum + memo.avgWA[ w ].sum + memo.avgWA[ w+1 ].sum ) / ( memo.avgWA[ w-1 ].count + memo.avgWA[ w ].count + memo.avgWA[ w+1 ].count ); | ||
+ | } | ||
+ | |||
+ | // make running average of 5 week averages | ||
+ | for ( var w=2; w<(memo.avgWA.length-2); w++ ) { | ||
+ | memo.avgWA[ w ].running = ( memo.avgWA[ w-2 ].sum + memo.avgWA[ w-1 ].sum + memo.avgWA[ w ].sum + memo.avgWA[ w+1 ].sum + memo.avgWA[ w+2 ].sum ) / ( memo.avgWA[ w-2 ].count + memo.avgWA[ w-1 ].count + memo.avgWA[ w ].count + memo.avgWA[ w+1 ].count + memo.avgWA[ w+2 ].count ); | ||
+ | } | ||
+ | |||
+ | // make raw hma | ||
+ | for ( var w=0; w<(memo.avgWA.length); w++ ) { | ||
+ | memo.avgWA[ w ].hma = 2*memo.avgWA[ w ].running3 - memo.avgWA[ w ].running5; | ||
+ | memo.avgWA[ w ].hmas = memo.avgWA[ w ].hma; | ||
+ | } | ||
+ | |||
+ | for ( var w=1; w<(memo.avgWA.length-1); w++ ) { | ||
+ | memo.avgWA[ w ].hmas = ( memo.avgWA[ w-1 ].hma + memo.avgWA[ w ].hma + memo.avgWA[ w+1 ].hma ) / ( 3 ); | ||
+ | } | ||
+ | |||
// make running average of week averages | // make running average of week averages | ||
Rivi 732: | Rivi 757: | ||
} | } | ||
− | memo.seriesA.push( { 'type': 'scatter', 'title': ' | + | memo.seriesA.push( { 'type': 'scatter', 'title': 'Hull', 'color': 'green', 'size': 0, 'line': 2.33, 'legend': true, 'trendline': 'none', obses: [] } ); |
for ( var w in memo.avgWA ) { | for ( var w in memo.avgWA ) { | ||
memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | ||
'x': memo.avgWA[ w ].cDate, | 'x': memo.avgWA[ w ].cDate, | ||
//'y': memo.avgWA[ w ].running + Math.max( memo.avgWA[ w ].dev, devAvg ) * 2, | //'y': memo.avgWA[ w ].running + Math.max( memo.avgWA[ w ].dev, devAvg ) * 2, | ||
− | 'y': memo.avgWA[ w ]. | + | 'y': memo.avgWA[ w ].hmas, |
'style': null, | 'style': null, | ||
'tooltip': '', | 'tooltip': '', |