Ero sivun ”Widget:JwObsCharts” versioiden välillä
Järvi-meriwikistä
Rivi 311: | Rivi 311: | ||
memo.jw.loadObses( { 'obscode': memo.obscodeParts[0], 'siteid': memo.siteid, 'startdate': memo.startDate, 'custom': custom }, function( o ) { | memo.jw.loadObses( { 'obscode': memo.obscodeParts[0], 'siteid': memo.siteid, 'startdate': memo.startDate, 'custom': custom }, function( o ) { | ||
+ | //console.log( JSON.stringify( memo.jw.obs ) ); | ||
memo.obses = memo.jw.obs; | memo.obses = memo.jw.obs; | ||
if ( memo.refcode != '-' ) { | if ( memo.refcode != '-' ) { | ||
Rivi 401: | Rivi 402: | ||
// 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 608: | Rivi 609: | ||
obs = memo.obsesA[0]; | obs = memo.obsesA[0]; | ||
− | + | for (var r in memo.refs) { | |
− | console.log( memo ); | + | ref = memo.refs[r]; |
− | + | break; | |
+ | } | ||
+ | |||
+ | refdata = JSON.parse( ref.printouts.DataJSON ); | ||
+ | //console.log( memo ); | ||
+ | refn = refdata.val; | ||
− | diff = obs.value - | + | diff = obs.value - refn; |
diff = Math.round( diff*100 ); | diff = Math.round( diff*100 ); | ||
diffStr = diff.toString() + ' cm'; | diffStr = diff.toString() + ' cm'; |