Ero sivun ”Widget:XJwCharts” versioiden välillä
Järvi-meriwikistä
Rivi 24: | Rivi 24: | ||
jw.loadObses( { 'obscode': 'ice', 'siteid': '284245', 'custom': '[[Jäätilanne::2||5]]' }, function( o ) { | jw.loadObses( { 'obscode': 'ice', 'siteid': '284245', 'custom': '[[Jäätilanne::2||5]]' }, function( o ) { | ||
− | console.log( jw ); | + | //console.log( jw ); |
+ | |||
+ | var data = {}; | ||
+ | var firstW = 3000; lastW = 0; | ||
for ( var o in jw.obsList ) { | for ( var o in jw.obsList ) { | ||
var obs = jw.obs[ jw.obsList [ o ] ]; | var obs = jw.obs[ jw.obsList [ o ] ]; | ||
+ | obs.data = JSON.parse( obs.printouts.DataJSON ); | ||
+ | |||
+ | var winter = obs.obsdatetime.getFullYear(); | ||
+ | if ( obs.obsdatetime.getMonth() > -1 && obs.obsdatetime.getMonth() < 8 ) { winter--; }; | ||
+ | |||
+ | firstW = Math.min( firstW, winter ); lastW = Math.min( lastW, winter ); | ||
+ | |||
+ | if ( typeof data[ winter ] == 'undefined' ) { data[ winter ] = { 'winter': winter }; } | ||
+ | |||
+ | if ( obs.data.cat == 2 ) { | ||
+ | data[ winter ].freeze = new Date( 2021, obs.obsdatetime.getMonth(), obs.obsdatetime.getDate() ); | ||
+ | } else if ( obs.data.cat == 5 ) { | ||
+ | data[ winter ].breakup = new Date( 2021, obs.obsdatetime.getMonth(), obs.obsdatetime.getDate() ); | ||
+ | } | ||
+ | |||
+ | //console.log( winter ); | ||
+ | |||
+ | //var freezeD = new Date( 2021', obs.obsdatetime.getMonth(), obs.obsdatetime.getDate() ); | ||
+ | //var freezeD = new Date( 2021', obs.obsdatetime.getMonth(), obs.obsdatetime.getDate() ); | ||
− | + | //row = [ winter ] | |
} | } | ||
+ | |||
+ | console.log( data ); | ||