Ero sivun ”Widget:XJwCharts” versioiden välillä
Järvi-meriwikistä
Rivi 119: | Rivi 119: | ||
memo.obsesTotal++; | memo.obsesTotal++; | ||
− | memo.obsMinValue = Math.min( memo.obsMinValue, | + | memo.obsMinValue = Math.min( memo.obsMinValue, obs.value ); |
− | memo.obsMaxValue = Math.max( memo.obsMaxValue, | + | memo.obsMaxValue = Math.max( memo.obsMaxValue, obs.value ); |
− | memo.obsMinDateMs = Math.min( memo.obsMinDateMs, | + | memo.obsMinDateMs = Math.min( memo.obsMinDateMs, obs.datetime.getTime() ); |
− | memo.obsMaxDateMs = Math.max( memo.obsMaxDateMs, | + | memo.obsMaxDateMs = Math.max( memo.obsMaxDateMs, obs.datetime.getTime() ); |
// add compare date to obses | // add compare date to obses | ||
Rivi 137: | Rivi 137: | ||
// add series id | // add series id | ||
if ( memo.graphType == 'trend' ) { | if ( memo.graphType == 'trend' ) { | ||
− | + | obs.seriesId = 0; | |
− | } else if ( memo.season == 'summer' || | + | } else if ( memo.season == 'summer' || obs.datetime.getMonth() > 7 ) { |
− | + | obs.seriesId = obs.datetime.getFullYear(); | |
} else { | } else { | ||
− | + | obs.seriesId = obs.datetime.getFullYear()-1; | |
} | } | ||
// create popup for obs | // create popup for obs | ||
− | + | obs.popup = '<div style="padding: 8px;">'; | |
− | + | obs.popup += '<div>'; | |
if ( i18n[memo.obscode]['type'] == 'cat') { | if ( i18n[memo.obscode]['type'] == 'cat') { | ||
− | + | obs.popup +='<b>' + i18n[memo.obscode]['title'][memo.lang] + ': ' + i18n[memo.obscode]['catNames'][obs.value][memo.lang] + '</b> '; | |
} else if ( i18n[memo.obscode]['type'] == 'date') { | } else if ( i18n[memo.obscode]['type'] == 'date') { | ||
− | + | obs.popup +='<b>' + i18n[memo.obscode]['title'][memo.lang] + '</b> '; | |
} else { | } else { | ||
− | + | obs.popup +='<b>' + i18n[memo.obscode]['title'][memo.lang] + ': ' + (Math.round(obs.value * 10)/10).toString().replace( '.', i18n['dec'][memo.lang] ) + ' ' + i18n[memo.obscode]['unit'] + '</b> '; | |
} | } | ||
− | + | obs.popup += '(' + obs.datetime.inRelationToToday(memo.lang) + ')'; | |
− | + | obs.popup += '</div>'; | |
− | if (!! | + | if (!!obs.addInfo) { obs.popup += '<div style="margin-top: 5px;">' + obs.addInfo + '</div>'; } |
− | + | obs.popup += '</div>'; | |
} | } |