Ero sivun ”Widget:JwObsCharts” versioiden välillä
Järvi-meriwikistä
Rivi 373: | Rivi 373: | ||
function drawVisualization( memo ) { | function drawVisualization( memo ) { | ||
− | if ( typeof i18n[ memo.obscode ].direction != 'undefined' ) { memo.vaxisdir = i18n[ memo.obscode ].direction; } else { memo.vaxisdir = 1; } | + | if ( typeof i18n[memo.obscode].valfield == 'undefined' ) { i18n[memo.obscode].valfield = 'val'; } |
+ | if ( typeof i18n[ memo.obscode ].direction != 'undefined' ) { memo.vaxisdir = i18n[ memo.obscode ].direction; } else { memo.vaxisdir = 1; } | ||
memo.options = { | memo.options = { | ||
Rivi 439: | Rivi 440: | ||
obs = memo.obses[o]; | obs = memo.obses[o]; | ||
+ | |||
+ | if ( i18n[memo.obscode].valfield != 'val' ) { | ||
+ | obs.value = obs.data[ i18n[memo.obscode].valfield ]; | ||
+ | } | ||
memo.obsesTotal++; | memo.obsesTotal++; | ||
Rivi 444: | Rivi 449: | ||
// create data | // create data | ||
obs.data = JSON.parse( obs.printouts.DataJSON ); | obs.data = JSON.parse( obs.printouts.DataJSON ); | ||
+ | obs.data.num = obs.data[ i18n[memo.obscode].valfield ]; | ||
if ( obs.data.unit == 'cm' && i18n[memo.obscode]['unit'] == 'm' ) { | if ( obs.data.unit == 'cm' && i18n[memo.obscode]['unit'] == 'm' ) { | ||
− | obs.data. | + | obs.data.num = obs.data.num/100; |
obs.value = obs.value/100; | obs.value = obs.value/100; | ||
} | } | ||
Rivi 521: | Rivi 527: | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
memo.obsMinDate = new Date( memo.obsMinDateMs ); | memo.obsMinDate = new Date( memo.obsMinDateMs ); | ||
Rivi 1 860: | Rivi 1 850: | ||
'snow_load': { | 'snow_load': { | ||
'catName': 'Lumikuorma', | 'catName': 'Lumikuorma', | ||
+ | 'valfield': 'load', | ||
'type': 'num', | 'type': 'num', | ||
'season': 'winter', | 'season': 'winter', |