Ero sivun ”Widget:JwObsCharts” versioiden välillä
Järvi-meriwikistä
Rivi 352: | Rivi 352: | ||
memo.jwR.loadObses( { "obscode": memo.refcode, "siteid": memo.siteid, "sort": "SiteID", "custom": memo.reffilter }, function( r ) { | memo.jwR.loadObses( { "obscode": memo.refcode, "siteid": memo.siteid, "sort": "SiteID", "custom": memo.reffilter }, function( r ) { | ||
memo.refs = memo.jwR.obs; | memo.refs = memo.jwR.obs; | ||
− | console.log( memo.obses ); | + | //console.log( memo.obses ); |
− | console.log( memo.refs ); | + | //console.log( memo.refs ); |
drawVisualization(memo); | drawVisualization(memo); | ||
}); | }); | ||
Rivi 445: | Rivi 445: | ||
// create data | // create data | ||
− | obs.data = JSON.parse( obs.printouts.DataJSON ); | + | obs.data = JSON.parse( obs.printouts.DataJSON ); |
if ( obs.data.unit == 'cm' && i18n[memo.obscode]['unit'] == 'm' ) { | if ( obs.data.unit == 'cm' && i18n[memo.obscode]['unit'] == 'm' ) { | ||
Rivi 523: | Rivi 523: | ||
} | } | ||
+ | |||
+ | if ( typeof memo.refs != 'undefined' ) { | ||
+ | var refs = {}; | ||
+ | for ( var r in memo.refs ) { | ||
+ | ref = memo.refs[r]; | ||
+ | refdata = JSON.parse( ref.printouts.DataJSON ); | ||
+ | refs[ refdata.week ] = refdata; | ||
+ | } | ||
+ | console.log( refs ); | ||
+ | for ( var o in memo.obses ) { | ||
+ | w = memo.obses[o].data.week; | ||
+ | memo.obses[o].data.low = refs[ w ].low; | ||
+ | memo.obses[o].data.high = refs[ w ].high; | ||
+ | memo.obses[o].data.mean = refs[ w ].val; | ||
+ | } | ||
+ | } | ||
memo.obsMinDate = new Date( memo.obsMinDateMs ); | memo.obsMinDate = new Date( memo.obsMinDateMs ); |