Ero sivun ”Widget:Test4” versioiden välillä
Järvi-meriwikistä
Rivi 700: | Rivi 700: | ||
} | } | ||
− | } | + | } |
+ | |||
+ | // calculate standard deviation | ||
+ | devSum = 0; | ||
+ | devC = 0; | ||
+ | devMax = 0; | ||
+ | for ( var y in memo.avgW ) { | ||
+ | for ( var w in memo.avgW[y] ) { | ||
+ | devC++; | ||
+ | devx = 0; | ||
+ | for (var vi in memo.avgW[y][w].values ) { | ||
+ | devx += Math.pow( (memo.avgW[y][w].values[vi] - memo.avgW[y][w].avg), 2 ); | ||
+ | } | ||
+ | memo.avgW[y][w].dev = Math.sqrt( devx/memo.avgW[y][w].count ); | ||
+ | devSum += memo.avgW[y][w].dev; | ||
+ | devMax = Math.max( memo.avgW[y][w].dev, devMax ); | ||
+ | } | ||
+ | } | ||
memo.seriesA.push( { 'type': 'area', 'title': 'Running', 'color': colors.average, 'size': 0, 'line': 2.33, 'legend': true, 'trendline': 'none', obses: [] } ); | memo.seriesA.push( { 'type': 'area', 'title': 'Running', 'color': colors.average, 'size': 0, 'line': 2.33, 'legend': true, 'trendline': 'none', obses: [] } ); | ||
Rivi 713: | Rivi 730: | ||
} | } | ||
+ | |||
+ | memo.seriesA.push( { 'type': 'area', 'title': 'Running', 'color': 'green', 'size': 0, 'line': 2.33, 'legend': true, 'trendline': 'none', obses: [] } ); | ||
+ | for ( var w in memo.avgWA ) { | ||
+ | memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | ||
+ | 'x': memo.avgWA[ w ].cDate, | ||
+ | 'y': memo.avgWA[ w ].running + memo.avgWA[ w ].dev, | ||
+ | 'style': null, | ||
+ | 'tooltip': '', | ||
+ | 'annotation': null | ||
+ | }); | ||
+ | |||
+ | } | ||
+ | |||
+ | for ( var w=0; w<memo.avgWA.length; w++ ) { | ||
+ | //Integer( SquareRoot(Period) ) WMA [2 x Integer(Period/2) WMA(Price) - Period WMA(Price)] | ||
+ | } | ||
// add columns | // add columns | ||
Rivi 742: | Rivi 775: | ||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
− | memo.options.series.push( { type: 'area', curveType: 'function', pointType: 'circle', pointSize: memo.seriesA[ s ].size, lineWidth: memo.seriesA[ s ].line, 'color': memo.seriesA[ s ].color, 'areaOpacity': 0. | + | memo.options.series.push( { type: 'area', curveType: 'function', pointType: 'circle', pointSize: memo.seriesA[ s ].size, lineWidth: memo.seriesA[ s ].line, 'color': memo.seriesA[ s ].color, 'areaOpacity': 0.8, 'visibleInLegend': memo.seriesA[ s ].legend } ); |
if ( memo.seriesA[ s ].trendline != 'none' ) { | if ( memo.seriesA[ s ].trendline != 'none' ) { |