Ei muokkausyhteenvetoa |
Ei muokkausyhteenvetoa |
||
| (28 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
| Rivi 229: | Rivi 229: | ||
headerCols.push( i18n['Time'][memo.lang] ); | headerCols.push( i18n['Time'][memo.lang] ); | ||
headerCols.push( '"' + i18n[memo.obscode].axisTitleV[memo.lang] + '"' ); | headerCols.push( '"' + i18n[memo.obscode].axisTitleV[memo.lang] + '"' ); | ||
headerCols.push( ' | headerCols.push( i18n['Additionalinfo'][memo.lang] ); | ||
headerCols.push( 'Valokuva' ); | headerCols.push( 'Valokuva' ); | ||
headerCols.push( 'Havainnoijan status' ); | headerCols.push( 'Havainnoijan status' ); | ||
| Rivi 248: | Rivi 248: | ||
csvCols.push( '"' + memo.obses[o].value.toString().replace( '.', i18n['dec'][memo.lang] ) + '"' ); | csvCols.push( '"' + memo.obses[o].value.toString().replace( '.', i18n['dec'][memo.lang] ) + '"' ); | ||
csvCols.push( memo.obses[o]. | csvCols.push( memo.obses[o].addInfoTxt ); | ||
csvCols.push( memo.obses[o].media_url ); | csvCols.push( memo.obses[o].media_url ); | ||
csvCols.push( memo.obses[o].maintainer ); | csvCols.push( memo.obses[o].maintainer ); | ||
| Rivi 286: | Rivi 286: | ||
csv += ';' + obs.value; | csv += ';' + obs.value; | ||
csv += ';' + obs.valueUnit; | csv += ';' + obs.valueUnit; | ||
csv += ';' + obs.addInfoTxt; | |||
csv += ';' + obs. | csv += ';' + obs.media_url; | ||
csv += ';'; | |||
csv += ';' + obs.maintainer; | csv += ';' + obs.maintainer; | ||
| Rivi 320: | Rivi 319: | ||
csv += ';' + i18n[memo.obscode].catNames[memo.obses[o].value][memo.lang]; | csv += ';' + i18n[memo.obscode].catNames[memo.obses[o].value][memo.lang]; | ||
csv += ';' + memo.obses[o]. | csv += ';' + memo.obses[o].addInfoTxt; | ||
csv += ';'; | csv += ';' + memo.obses[o].media_url; | ||
csv += ';' + memo.obses[o].maintainer; | csv += ';' + memo.obses[o].maintainer; | ||
| Rivi 405: | Rivi 404: | ||
so.test = true; | so.test = true; | ||
} | } | ||
memo.jw.loadObses( so, function( o ) { | |||
memo.jw.loadObses( so, function( o ) { | //if ( memo.obscode == 'ice_cat_2,4,5' ) { | ||
if ( memo.obscode == ' | //for ( var i in memo.jw.obs ) { | ||
//console.log( memo.jw.obs[i].printouts.DataJSON[0] ); | |||
//} | |||
//} | |||
memo.obses = memo.jw.obs; | memo.obses = memo.jw.obs; | ||
drawVisualization(memo); | drawVisualization(memo); | ||
| Rivi 525: | Rivi 527: | ||
// create addinfo | // create addinfo | ||
obs.addInfo = ""; | obs.addInfo = ""; | ||
if ( !!obs.media_url ) { | obs.addInfoTxt = ""; | ||
if ( !!obs.media_url ) { | |||
obs.img = new Image(); | obs.img = new Image(); | ||
obs.img.src = obs.media_url; | obs.img.src = obs.media_url; | ||
obs.addInfo = '<img style="object-fit: cover; width: 200px; height: 200px; margin: 5px 0 8px 0;" src="' + obs.media_url + '" />'; | obs.addInfo = '<img style="object-fit: cover; width: 200px; height: 200px; margin: 5px 0 8px 0;" src="' + obs.media_url + '" />'; | ||
} else { | |||
obs.media_url = ''; | |||
} | } | ||
if ( !!obs.printouts[ 'Lisätiedot' ][0] ) { | if ( !!obs.printouts[ 'Lisätiedot' ][0] ) { | ||
obs. | obs.addInfoTxt = obs.printouts[ 'Lisätiedot' ][0]; | ||
obs.addInfo += '<p>' + obs.addInfoTxt + '</p>'; | |||
} | } | ||
| Rivi 895: | Rivi 901: | ||
memo.obsesS[ obs.season ][ 'high' ] = obs.compareDate; | memo.obsesS[ obs.season ][ 'high' ] = obs.compareDate; | ||
} | } | ||
if ( memo.obsesS[ obs.season ][ 'maintainer' ] != obs.maintainer ) { memo.obsesS[ obs.season ][ 'maintainer' ] = ''; } | if ( memo.obsesS[ obs.season ][ 'maintainer' ] != obs.maintainer ) { memo.obsesS[ obs.season ][ 'maintainer' ] = ''; } | ||
| Rivi 902: | Rivi 909: | ||
memo.seriesO[ 'ice_cat_2,5' ] = { 'id': 'ice_cat_2,5', 'order': 10, 'title': i18n[ 'ice_cat_2,5' ].title[ memo.lang ], 'type': 'candlestick', 'color': i18n[ 'ice_cat_2,5' ].color, obses: [] }; | memo.seriesO[ 'ice_cat_2,5' ] = { 'id': 'ice_cat_2,5', 'order': 10, 'title': i18n[ 'ice_cat_2,5' ].title[ memo.lang ], 'type': 'candlestick', 'color': i18n[ 'ice_cat_2,5' ].color, obses: [] }; | ||
} | } | ||
memo.seriesO[ 'ice_cat_2,5' ].obses.push( { 'obsdatetime': obs.obsdatetime, 'season': obs.season, 'value': days, 'valueUnit': i18n[ 'days' ][ memo.lang ], 'addInfo': '', 'maintainer': memo.obsesS[ obs.season ][ 'maintainer' ], 'xvalue': obs.seasonmiddle, 'low': memo.obsesS[ obs.season ][ 'low' ], 'high': memo.obsesS[ obs.season ][ 'high' ], 'tooltip': '<p><b>' + i18n[ 'season' ][ 'winter' ][ memo.lang ] + ' ' + obs.season + '–' + (obs.season+1) + '</b></p><p>' + i18n[ 'ice_cat_2,5' ].title[ memo.lang ] + ': ' + days + ' ' + i18n[ 'days' ][ memo.lang ] + '</p>' } ); | memo.seriesO[ 'ice_cat_2,5' ].obses.push( { 'obsdatetime': obs.obsdatetime, 'season': obs.season, 'value': days, 'valueUnit': i18n[ 'days' ][ memo.lang ], 'addInfo': '', 'addInfoTxt': '', 'media_url': '', 'maintainer': memo.obsesS[ obs.season ][ 'maintainer' ], 'xvalue': obs.seasonmiddle, 'low': memo.obsesS[ obs.season ][ 'low' ], 'high': memo.obsesS[ obs.season ][ 'high' ], 'tooltip': '<p><b>' + i18n[ 'season' ][ 'winter' ][ memo.lang ] + ' ' + obs.season + '–' + (obs.season+1) + '</b></p><p>' + i18n[ 'ice_cat_2,5' ].title[ memo.lang ] + ': ' + days + ' ' + i18n[ 'days' ][ memo.lang ] + '</p>' } ); | ||
} | } | ||
} | } | ||
} | } | ||
//console.log( memo.obscode ); | |||
// create ice cover series | |||
if ( memo.obscode == 'ice_cat_2,4,5' ) { | |||
memo.obsesS = {}; | |||
//console.log( memo ); | |||
for ( var o in memo.obsesA ) { | |||
var obs = memo.obsesA[ o ]; | |||
if ( typeof memo.obsesS[ obs.season ] == 'undefined' ) { | |||
memo.obsesS[ obs.season ] = { 'maintainer': obs.maintainer }; | |||
} | |||
memo.data.addColumn( 'date', memo.seriesA[ s ].title ); // + ' ' + memo.obsMinYear + '-' + memo.obsMaxYear ); | if ( obs.data.cat == '2' ) { | ||
memo.data.addColumn( { type: 'string', 'role': 'style' } ); | memo.obsesS[ obs.season ][ 'low' ] = obs.compareDate; | ||
memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | } else if ( obs.data.cat == '5' ) { | ||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | memo.obsesS[ obs.season ][ 'high' ] = obs.compareDate; | ||
} | |||
memo.options.series.push( { type: 'scatter', pointType: 'circle', pointSize: 10, color: memo.seriesA[ s ].color } ); | |||
if ( memo.obsesS[ obs.season ][ 'maintainer' ] != obs.maintainer ) { memo.obsesS[ obs.season ][ 'maintainer' ] = ''; } | |||
if ( typeof memo.obsesS[ obs.season ][ 'low' ] != 'undefined' && typeof memo.obsesS[ obs.season ][ 'high' ] != 'undefined' ) { | |||
days = Math.round( ( memo.obsesS[ obs.season ][ 'high' ].getTime() - memo.obsesS[ obs.season ][ 'low' ].getTime() ) / ( 1000*60*60*24 ) ); | |||
if ( typeof memo.seriesO[ 'ice_cat_2,5' ] == 'undefined' ) { | |||
memo.seriesO[ 'ice_cat_2,5' ] = { 'id': 'ice_cat_2,5', 'order': 10, 'title': i18n[ 'ice_cat_2,5' ].title[ memo.lang ], 'type': 'candlestick', 'color': i18n[ 'ice_cat_2,5' ].color, obses: [] }; | |||
} | |||
memo.seriesO[ 'ice_cat_2,5' ].obses.push( { 'obsdatetime': obs.obsdatetime, 'season': obs.season, 'value': days, 'valueUnit': i18n[ 'days' ][ memo.lang ], 'addInfo': '', 'addInfoTxt': '', 'media_url': '', 'maintainer': memo.obsesS[ obs.season ][ 'maintainer' ], 'xvalue': obs.seasonmiddle, 'low': memo.obsesS[ obs.season ][ 'low' ], 'high': memo.obsesS[ obs.season ][ 'high' ], 'tooltip': '<p><b>' + i18n[ 'season' ][ 'winter' ][ memo.lang ] + ' ' + obs.season + '–' + (obs.season+1) + '</b></p><p>' + i18n[ 'ice_cat_2,5' ].title[ memo.lang ] + ': ' + days + ' ' + i18n[ 'days' ][ memo.lang ] + '</p>' } ); | |||
} | |||
if ( obs.data.cat == '4' ) { | |||
if ( typeof memo.seriesO[ 'ice_cat_4' ] == 'undefined' ) { | |||
memo.seriesO[ 'ice_cat_4' ] = { 'id': 'ice_cat_4', 'order': 10, 'title': i18n[ 'ice_cat_4' ].title[ memo.lang ], 'type': 'download', 'color': i18n[ 'ice_cat_4' ].color, obses: [] }; | |||
} | |||
memo.seriesO[ 'ice_cat_4' ].obses.push( { 'obsdatetime': obs.obsdatetime, 'season': obs.season, 'value': i18n[ 'ice_cat_4' ].title[ memo.lang ], 'valueUnit': '', 'addInfo': '', 'addInfoTxt': '', 'media_url': '', 'maintainer': memo.obsesS[ obs.season ][ 'maintainer' ], 'xvalue': obs.seasonmiddle, 'tooltip': '<p><b>' + i18n[ 'season' ][ 'winter' ][ memo.lang ] + ' ' + obs.season + '–' + (obs.season+1) + '</b></p><p>' + i18n[ 'ice_cat_4' ].title[ memo.lang ] + ': ' + days + ' ' + i18n[ 'days' ][ memo.lang ] + '</p>' } ); | |||
} | |||
} | |||
} | |||
memo.seriesA = []; for ( var s in memo.seriesO ) { memo.seriesA.push( memo.seriesO[s] ) }; | |||
memo.seriesA.sort( function( a, b ) { return a.order-b.order; } ); | |||
for ( var s in memo.seriesA ) { | |||
if ( memo.seriesA[ s ].type == 'scatter' ) { | |||
memo.data.addColumn( 'date', memo.seriesA[ s ].title ); // + ' ' + memo.obsMinYear + '-' + memo.obsMaxYear ); | |||
memo.data.addColumn( { type: 'string', 'role': 'style' } ); | |||
memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | |||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | |||
memo.options.series.push( { type: 'scatter', pointType: 'circle', pointSize: 10, color: memo.seriesA[ s ].color } ); | |||
if ( memo.seriesA[ s ].obses.length > 4 ) { | if ( memo.seriesA[ s ].obses.length > 4 ) { | ||
| Rivi 937: | Rivi 983: | ||
memo.options.series.push( { type: 'candlesticks', color: memo.seriesA[ s ].color, strokeWidth: 2, stroke: '#cccccc' } ); | memo.options.series.push( { type: 'candlesticks', color: memo.seriesA[ s ].color, strokeWidth: 2, stroke: '#cccccc' } ); | ||
} else if ( memo.seriesA[ s ].type == 'candlestick3' ) { | |||
memo.data.addColumn( 'date', memo.seriesA[ s ].title ); | |||
memo.data.addColumn( 'date', '' ); | |||
memo.data.addColumn( 'date', '' ); | |||
memo.data.addColumn( 'date', '' ); | |||
memo.data.addColumn({ role: 'tooltip', 'p': { 'html': true } }); | |||
memo.data.addColumn( 'date', '' ); | |||
memo.data.addColumn( { type: 'string', 'role': 'style' } ); | |||
memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | |||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | |||
memo.options.series.push( { type: 'candlesticks', color: memo.seriesA[ s ].color, strokeWidth: 2, stroke: '#cccccc' } ); | |||
memo.options.series.push( { type: 'scatter', color: memo.seriesA[ s ].color, strokeWidth: 2, stroke: '#cccccc' } ); | |||
} | |||
} | } | ||
| Rivi 1 436: | Rivi 1 497: | ||
} | } | ||
console.log( memo ); | //console.log( memo ); | ||
// calculate standard deviation | // calculate standard deviation | ||
| Rivi 2 058: | Rivi 2 119: | ||
}, | }, | ||
'ice_cat': { | 'ice_cat': { | ||
'catName': 'Jäätilanne', | 'catName': 'Jäätilanne', | ||
}, | |||
'ice_cat_2': { | |||
'title': { 'fi': 'Pysyvä jääpeite alkoi', 'en': 'Permanent ice cover began', 'sv': 'Permanent isläggning började', 'ru': '???' }, | |||
'title2': { 'fi': 'Pysyvä jääpeite alkoi', 'en': 'Permanent ice cover began', 'sv': 'Permanent istäcke började', 'ru': '???' }, | |||
'color': colors[ 'winter' ] | |||
}, | |||
'ice_cat_5': { | |||
'title': { 'fi': 'Jäätön kausi alkoi', 'en': 'Ice-free season began', 'sv': 'Isfri säsong började', 'ru': '???' }, | |||
'title2': { 'fi': 'Jäätön kausi alkoi', 'en': 'Ice-free season began', 'sv': 'Isfri säsong började', 'ru': '???' }, | |||
'color': '#006085' | |||
}, | }, | ||
'ice_cat_2,5': { | 'ice_cat_2,5': { | ||
'type': 'date', | 'type': 'date', | ||
| Rivi 2 071: | Rivi 2 140: | ||
'unit': { 'fi': 'päivää', 'en': 'days', 'sv': 'dagar', 'ru': '' }, | 'unit': { 'fi': 'päivää', 'en': 'days', 'sv': 'dagar', 'ru': '' }, | ||
'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' }, | 'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' }, | ||
}, | }, | ||
'ice_cat_2,4,5': { | |||
'type': 'date', | |||
'season': 'winter', | |||
'direction': -1, | |||
'trend': { 'type': 'regression', 'layout': 'line' }, | |||
'title': { 'fi': 'Jääpeitekauden kesto', 'en': 'Duration of ice cover', 'sv': 'Längden på istäckesperioden', 'ru': '' }, | |||
'color': '#c1e7f7', | |||
'unit': { 'fi': 'päivää', 'en': 'days', 'sv': 'dagar', 'ru': '' }, | |||
'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' } | |||
}, | |||
'ice_cat_4': { | |||
'type': 'date', | |||
'season': 'winter', | |||
'direction': -1, | |||
'trend': { 'type': 'regression', 'layout': 'line' }, | |||
'title': { 'fi': 'Jäänlähtö', 'en': 'Ice break-up', 'sv': 'Islossning', 'ru': '???' }, | |||
'color': '#c1e7f7', | |||
'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' } | |||
}, | |||
'snow': { | 'snow': { | ||
'catName': 'Lumitilanne', | 'catName': 'Lumitilanne', | ||
| Rivi 2 138: | Rivi 2 220: | ||
'unit': 'µg/l', | 'unit': 'µg/l', | ||
'axisTitleV': { 'fi': 'Pitoisuus, µg/l', 'en': 'Concentration, µg/l', 'sv': 'Koncentration, µg/l', 'ru': 'm' } | 'axisTitleV': { 'fi': 'Pitoisuus, µg/l', 'en': 'Concentration, µg/l', 'sv': 'Koncentration, µg/l', 'ru': 'm' } | ||
}, | |||
'fe': { | |||
'type': 'num', | |||
'season': 'summer', | |||
'min': 0, | |||
'direction': 1, | |||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | |||
'title': { 'fi': 'Kokonaisrauta [D]', 'en': 'Total iron', 'sv': 'Totaljärn', 'ru': '???' }, | |||
'unit': 'µg/l', | |||
'axisTitleV': { 'fi': 'Pitoisuus, µg/l', 'en': 'Concentration, µg/l', 'sv': 'Koncentration, µg/l', 'ru': 'm' }, | |||
'depths': true | |||
}, | }, | ||
'o2': { | 'o2': { | ||


