Ei muokkausyhteenvetoa |
Ei muokkausyhteenvetoa |
||
| (102 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
| Rivi 81: | Rivi 81: | ||
memo.reffilter = jQuery( this ).attr( 'data-jw-reffilter' ); if ( typeof memo.reffilter == 'undefined' ) { memo.reffilter = ''; } | memo.reffilter = jQuery( this ).attr( 'data-jw-reffilter' ); if ( typeof memo.reffilter == 'undefined' ) { memo.reffilter = ''; } | ||
memo.obscodeParts = memo.obscode.split('_'); | memo.obscodeParts = memo.obscode.split('_'); | ||
memo.title = jQuery( this ).attr( 'data-title' ); if ( typeof memo.title == 'undefined' ) { memo.title = i18n[ memo.obscode ][ 'title' ][ memo.lang ]; } | memo.title = jQuery( this ).attr( 'data-title' ); if ( typeof memo.title == 'undefined' ) { memo.title = i18n[ memo.obscode ][ 'title' ][ memo.lang ]; } | ||
memo.info = jQuery( this ).attr( 'data-info' ); if ( typeof memo.info == 'undefined' ) { memo.info = ""; } | memo.info = jQuery( this ).attr( 'data-info' ); if ( typeof memo.info == 'undefined' ) { memo.info = ""; } | ||
if ( typeof jQuery( this ).attr( 'data-info-addsite' ) != 'undefined' ) { memo.addsitetoinfo = ( jQuery( this ).attr( 'data-info-addsite' ) == 'true' ); } else { memo.addsitetoinfo = false; }; | |||
memo.caption = jQuery( this ).attr( 'data-caption' ); if ( typeof memo.caption == 'undefined' ) { memo.caption = ""; } | memo.caption = jQuery( this ).attr( 'data-caption' ); if ( typeof memo.caption == 'undefined' ) { memo.caption = ""; } | ||
if ( typeof jQuery( this ).attr( 'data-jw-summerwinter' ) != 'undefined' ) { memo.summerwinter = ( jQuery( this ).attr( 'data-jw-summerwinter' ) == 'true' ); } else { memo.summerwinter = false; }; | if ( typeof jQuery( this ).attr( 'data-jw-summerwinter' ) != 'undefined' ) { memo.summerwinter = ( jQuery( this ).attr( 'data-jw-summerwinter' ) == 'true' ); } else { memo.summerwinter = false; }; | ||
if ( typeof jQuery( this ).attr( 'data-jw-summerother' ) != 'undefined' ) { memo.summerother = ( jQuery( this ).attr( 'data-jw-summerother' ) == 'true' ); } else { memo.summerother = false; }; | |||
if ( typeof jQuery( this ).attr( 'data-jw-bottomsurface' ) != 'undefined' ) { memo.bottomsurface = ( jQuery( this ).attr( 'data-jw-bottomsurface' ) == 'true' ); } else { memo.bottomsurface = false; }; | if ( typeof jQuery( this ).attr( 'data-jw-bottomsurface' ) != 'undefined' ) { memo.bottomsurface = ( jQuery( this ).attr( 'data-jw-bottomsurface' ) == 'true' ); } else { memo.bottomsurface = false; }; | ||
| Rivi 94: | Rivi 95: | ||
} else if ( memo.summerwinter ) { | } else if ( memo.summerwinter ) { | ||
memo.divide = 'summerwinter'; | memo.divide = 'summerwinter'; | ||
} else if ( memo.summerother ) { | |||
memo.divide = 'summerother'; | |||
} else { | } else { | ||
memo.divide = '-'; | memo.divide = '-'; | ||
}; | |||
if ( typeof jQuery( this ).attr( 'data-jw-divide-if-obses' ) != 'undefined' ) { | |||
memo.divideCond = parseInt( jQuery( this ).attr( 'data-jw-divide-if-obses' ) ); | |||
} else { | |||
memo.divideCond = 20; | |||
}; | }; | ||
| Rivi 114: | Rivi 123: | ||
memo.startDate = '1800-01-01'; | memo.startDate = '1800-01-01'; | ||
} | } | ||
memo.service = jQuery( this ).attr( 'data-coo311-service_code' ); | memo.service = jQuery( this ).attr( 'data-coo311-service_code' ); | ||
| Rivi 127: | Rivi 135: | ||
memo.widgetEl.css( 'position', 'relative' ); | memo.widgetEl.css( 'position', 'relative' ); | ||
memo.widgetEl.css( 'margin-bottom', '0.5em' ); | //memo.widgetEl.css( 'margin-bottom', '0.5em' ); | ||
// add loader animation | // add loader animation | ||
| Rivi 137: | Rivi 145: | ||
// add chart container | // add chart container | ||
memo.widgetEl.append( '<div class="card JwCard | memo.widgetEl.append( '<div class="card JwCard Xmb-2" style="position: relative; width: 100%; height: 100%;"><div class="card-header" style="min-height: 49px;"></div><div class="card-body p-2" style="position: relative; width: 100%; height: 100%;"><div class="chart-container" style="position: relative; z-index: 110; width: 100%; height: 100%;"></div></div><div class="card-footer"></div>' ); | ||
memo.chartEl = jQuery( this ).find( '.chart-container' ); | memo.chartEl = jQuery( this ).find( '.chart-container' ); | ||
memo.chartEl.css( 'height', memo.height + 'px' ); | memo.chartEl.css( 'height', memo.height + 'px' ); | ||
| Rivi 155: | Rivi 163: | ||
// add fullscreen button | // add fullscreen button | ||
memo.headerEl.append( '<div class="obschartbutton fullscreen-button" style="display: none; margin-left: 10px; float: right; | memo.headerEl.append( '<div class="obschartbutton fullscreen-button" style="display: none; margin-left: 10px; float: right; font-size: 18.72px;"><button title="' + i18n['fullscreen'][memo.lang] + '" style=""><i class="fas fa-expand"></i></button></div>' ); | ||
memo.fullscreenEl = jQuery( this ).find( '.fullscreen-button' ); | memo.fullscreenEl = jQuery( this ).find( '.fullscreen-button' ); | ||
| Rivi 194: | Rivi 202: | ||
}); | }); | ||
// add edit button | // add edit button | ||
if ( memo.editUrl != '-' ) { | if ( memo.editUrl != '-' ) { | ||
memo.headerEl.append( '<div class="obschartbutton edit-button" style="Xdisplay: none; margin-left: 10px; float: right; | memo.headerEl.append( '<div class="obschartbutton edit-button" style="Xdisplay: none; margin-left: 10px; float: right; font-size: 18.72px;"><button title="' + i18n['edit'][memo.lang] + '" style=""><i class="fas fa-edit"></i></button></div>' ); | ||
memo.editEl = jQuery( this ).find( '.edit-button' ); | memo.editEl = jQuery( this ).find( '.edit-button' ); | ||
memo.editEl.on( 'click', function() { window.location.href = memo.editUrl; }); | memo.editEl.on( 'click', function() { window.location.href = memo.editUrl; }); | ||
| Rivi 203: | Rivi 211: | ||
// add download data button | // add download data button | ||
if ( memo.download ) { | if ( memo.download ) { | ||
memo.headerEl.append( '<div class="obschartbutton download-button" style="display: none; margin-left: 10px; float: right; | memo.headerEl.append( '<div class="obschartbutton download-button" style="display: none; margin-left: 10px; float: right; font-size: 18.72px;"><button title="' + i18n['download'][memo.lang] + '" style=""><i class="fas fa-download"></i></button></div>' ); | ||
memo.downloadEl = jQuery( this ).find( '.download-button' ); | memo.downloadEl = jQuery( this ).find( '.download-button' ); | ||
| Rivi 218: | Rivi 226: | ||
if ( i18n[memo.obscode].type == 'num' ) { | if ( i18n[memo.obscode].type == 'num' ) { | ||
headerCols.push( '"' + i18n[memo.obscode].axisTitleV[memo.lang] + '"' ); | headerCols.push( '"' + i18n[memo.obscode].axisTitleV[memo.lang] + '"' ); | ||
headerCols.push( 'Lisätiedot' ); | headerCols.push( 'Lisätiedot' ); | ||
| Rivi 346: | Rivi 352: | ||
// add show site link button | // add show site link button | ||
if ( memo.showlink ) { | if ( memo.showlink ) { | ||
memo.headerEl.append( '<div class="obschartbutton sitelink-button" style="display: none; margin-left: 10px; float: right; | memo.headerEl.append( '<div class="obschartbutton sitelink-button" style="display: none; margin-left: 10px; float: right; font-size:18.72px;"><button title="' + i18n['sitelink'][memo.lang] + '" style="width: 24px; height: 24px; padding: 0; margin: 0; background: none; border: none; "><i class="fas fa-map-marked"></i></button></div>' ); | ||
memo.sitelinkEl = jQuery( this ).find( '.sitelink-button' ); | memo.sitelinkEl = jQuery( this ).find( '.sitelink-button' ); | ||
memo.sitelinkEl.on( 'click', function() { | memo.sitelinkEl.on( 'click', function() { | ||
| Rivi 354: | Rivi 360: | ||
} | } | ||
} | } | ||
memo.loadStarts = 0; | memo.loadStarts = 0; | ||
| Rivi 396: | Rivi 402: | ||
if ( memo.siteid == '170072' ) { | if ( memo.siteid == '170072' ) { | ||
so.test = true; | so.test = true; | ||
} | } | ||
memo.jw.loadObses( so, function( o ) { | memo.jw.loadObses( so, function( o ) { | ||
| Rivi 510: | Rivi 516: | ||
// create addinfo | // create addinfo | ||
obs.addInfo = ""; | obs.addInfo = ""; | ||
if ( !!obs.media_url ) { | 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=" | obs.addInfo = '<img style="object-fit: cover; width: 200px; height: 200px; margin: 5px 0 8px 0;" src="' + obs.media_url + '" />'; | ||
} | } | ||
if ( !!obs.printouts[ 'Lisätiedot' ][0] ) { | if ( !!obs.printouts[ 'Lisätiedot' ][0] ) { | ||
| Rivi 547: | Rivi 553: | ||
obs.seriesId = 'other'; | obs.seriesId = 'other'; | ||
} | } | ||
} else if ( memo.divide == 'summerother' ) { | |||
if ( obs.compareDate.getMonth() > 4 && obs.compareDate.getMonth() < 9 ) { | |||
obs.seriesId = 'summer'; | |||
} else { | |||
obs.seriesId = 'other'; | |||
} | |||
} else if ( memo.divide == 'bottomsurface' ) { | } else if ( memo.divide == 'bottomsurface' ) { | ||
if ( obs.data.depthR == 'bottom' ) { | if ( obs.data.depthR == 'bottom' ) { | ||
| Rivi 567: | Rivi 579: | ||
// create popup for obs | // create popup for obs | ||
obs.popup = '<div style="padding: 8px;">'; | obs.popup = '<div style="padding: 8px; white-space: normal;">'; | ||
obs.popup += '<div>'; | obs.popup += '<div>'; | ||
| Rivi 579: | Rivi 591: | ||
obs.popup += '(' + obs.obsdatetime.inRelationToToday(memo.lang) + ')'; | obs.popup += '(' + obs.obsdatetime.inRelationToToday(memo.lang) + ')'; | ||
obs.popup += '</div>'; | obs.popup += '</div>'; | ||
if (!!obs.addInfo) { | if (!!obs.addInfo) { | ||
| Rivi 595: | Rivi 607: | ||
memo.obsMaxCompDate = new Date( memo.obsMaxCompDateMs ); | memo.obsMaxCompDate = new Date( memo.obsMaxCompDateMs ); | ||
memo.obsesA = []; memo.dataA = []; | memo.obsesA = []; memo.dataA = []; memo.depthsO = {}; | ||
for ( var o in memo.obses ) { | for ( var o in memo.obses ) { | ||
| Rivi 627: | Rivi 639: | ||
memo.obsesA.push( obs ); | memo.obsesA.push( obs ); | ||
if ( typeof obs.data.depthR != 'undefined' ) { | |||
if ( typeof memo.depthsO[ obs.data.depthR ] == 'undefined' ) { memo.depthsO[ obs.data.depthR ] = { 'values': [], 'valstrings': [], 'valstring': '' }; } | |||
if ( typeof obs.data.depthAval != 'undefined' ) { | |||
if ( obs.data.depthAval!==null && obs.data.depthAval != '' ) { | |||
memo.depthsO[ obs.data.depthR ].values.push( obs.data.depthAval ); | |||
} | |||
} else { | |||
//memo.depthsO[ obs.data.depthR ].values.push( -1 ); | |||
} | |||
} | |||
} | } | ||
| Rivi 639: | Rivi 660: | ||
// col for xAxis values | // col for xAxis values | ||
memo.data.addColumn( 'date', 'time' ); | memo.data.addColumn( 'date', 'time' ); | ||
// make ticks for y axis on cat types | // | ||
if ( memo.obsesA.length > 0 && memo.graphType != 'current' ) { | var depthcats = []; var depthvals; | ||
for ( var di in memo.depthsO ) { | |||
if ( i18n[memo.obscode]['type'] == 'cat') { | |||
memo.options.vAxis.format = '0'; | memo.depthsO[ di ].values = [...new Set( memo.depthsO[ di ].values )].sort((a, b) => a - b); | ||
for ( var dv in memo.depthsO[ di ].values ) { | |||
memo.depthsO[ di ]['valstrings'].push( memo.depthsO[ di ].values[ dv ].toString().replace( '.', ',' ) ); | |||
} | |||
if ( memo.depthsO[ di ]['valstrings'].length > 0 ) { | |||
if ( memo.depthsO[ di ]['valstrings'].length == 1 ) { | |||
memo.depthsO[ di ]['valstring'] = memo.depthsO[ di ]['valstrings'][ 0 ] + ' m'; | |||
} else { | |||
memo.depthsO[ di ]['valstring'] = memo.depthsO[ di ]['valstrings'][ 0 ] + '–' + memo.depthsO[ di ]['valstrings'][ memo.depthsO[ di ]['valstrings'].length-1 ] + ' m'; | |||
} | |||
} | |||
depthcats.push( di ); | |||
} | |||
if ( depthcats.length == 1 ) { | |||
if ( depthcats[0] == 'surface' ) { | |||
memo.title = memo.title.replace( '[D]', '(' + i18n[ 'surface' ][ memo.lang ] + ')' ); | |||
} else if ( depthcats[0] == 'bottom' ) { | |||
memo.title = memo.title.replace( '[D]', '(' + i18n[ 'bottom' ][ memo.lang ] + ')' ); | |||
} | |||
} else if ( depthcats.length == 2 ) { | |||
} else { | |||
} | |||
// make ticks for y axis on cat types | |||
if ( memo.obsesA.length > 0 && memo.graphType != 'current' ) { | |||
if ( i18n[memo.obscode]['type'] == 'cat') { | |||
memo.options.vAxis.format = '0'; | |||
memo.options.vAxis.ticks = []; | memo.options.vAxis.ticks = []; | ||
for (var c in i18n[memo.obscode]['catNamesShort']) { | for (var c in i18n[memo.obscode]['catNamesShort']) { | ||
| Rivi 667: | Rivi 724: | ||
memo.options.vAxis.viewWindow.min = 0; | memo.options.vAxis.viewWindow.min = 0; | ||
} else { | } else { | ||
memo.options.vAxis.viewWindow.min = memo.obsMinValue; | // memo.options.vAxis.viewWindow.min = memo.obsMinValue; | ||
} | } | ||
} else { | } else { | ||
| Rivi 678: | Rivi 735: | ||
} | } | ||
} | } | ||
} | } | ||
memo.titleEl.html( memo.title ); | memo.titleEl.html( memo.title ); | ||
if ( typeof i18n[ memo.obscode ].changes != 'undefined' ) { | if ( typeof i18n[ memo.obscode ].changes != 'undefined' ) { | ||
| Rivi 690: | Rivi 745: | ||
} | } | ||
} | } | ||
if ( memo.info == '' ) { | |||
if ( memo.siteid != '-' && memo.addsitetoinfo ) { | |||
memo.info += i18n[ 'siteinfostring' ][ memo.lang] + ': ' + memo.jw.site[ memo.siteid ].name; | |||
} | |||
if ( depthcats.length == 1 ) { | |||
if ( memo.depthsO[ depthcats[0] ].valstring != '' ) { | |||
if ( memo.info != '' ) { memo.info += "<br />"; } | |||
memo.info += i18n[ 'depthinfostring' ][ memo.lang] + ': ' + memo.depthsO[ depthcats[0] ].valstring; | |||
} | |||
} | |||
} | |||
if ( memo.info != '' ) { | if ( memo.info != '' ) { | ||
memo.titleEl.append( ' <button style="padding: 0 0.25em; font-size: 13px; margin-bottom: 3px;" type="button" class="btn btn-secondary btn-info" data-toggle="tooltip" data-placement="top" title="' + memo.info + '"><span class="fontawesome"></span></button>' ); | memo.titleEl.append( ' <button style="padding: 0 0.25em; font-size: 13px; margin-bottom: 3px;" type="button" class="btn btn-secondary btn-info" data-toggle="tooltip" data-placement="top" data-html="true" title="' + memo.info + '"><span class="fontawesome"></span></button>' ); | ||
jQuery( '[data-toggle="tooltip"]' ).tooltip(); | jQuery( '[data-toggle="tooltip"]' ).tooltip(); | ||
} | } | ||
| Rivi 700: | Rivi 769: | ||
if ( memo.obsesA.length == 0 ) { | if ( memo.obsesA.length == 0 ) { | ||
console.log( | console.log( 'No obses' ); | ||
} else if (memo.graphType == 'trend') { | } else if (memo.graphType == 'trend') { | ||
| Rivi 933: | Rivi 1 002: | ||
function addDataToSeasonWithRefsChart(memo) { | function addDataToSeasonWithRefsChart(memo) { | ||
console.log( memo ); | |||
// do axis min and max | // do axis min and max | ||
memo.axisMinDate = new Date( memo.curSeason, 0, 1 ); | memo.axisMinDate = new Date( memo.curSeason, 0, 1 ); | ||
| Rivi 1 074: | Rivi 1 143: | ||
memo.axisMinDate.setDate(1); | memo.axisMinDate.setDate(1); | ||
memo.axisMaxDate.setDate(31); | memo.axisMaxDate.setDate(31); | ||
if ( memo.obsesA.length < memo.divideCond ) { memo.divide = '-'; } | |||
if ( memo.divide == 'summerwinter' ) { | if ( memo.divide == 'summerwinter' ) { | ||
| Rivi 1 095: | Rivi 1 166: | ||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | ||
} else if ( memo.divide == 'summerother' ) { | |||
memo.options.series[0] = { type: 'scatter', pointSize: 10, color: colors[ 'spring-autumn' ] }; | |||
memo.options.series[1] = { type: 'scatter', pointSize: 10, color: colors[ 'summer' ] }; | |||
memo.data.addColumn( 'number', 'Muu vuodenaika' ); | |||
memo.data.addColumn( {'type': 'string', 'role': 'style' } ); | |||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | |||
memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | |||
memo.data.addColumn( 'number', 'Kesä (kesä-syyskuu)' ); | |||
memo.data.addColumn( {'type': 'string', 'role': 'style' } ); | |||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | |||
memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | |||
} else if ( memo.divide == 'bottomsurface' ) { | } else if ( memo.divide == 'bottomsurface' ) { | ||
| Rivi 1 135: | Rivi 1 221: | ||
memo.options.trendlines[1] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['summer'], lineWidth: 3, originalLineWidth: 3, opacity: 1, type: memo.trendType, 'degree': 2, visibleInLegend: false }; | memo.options.trendlines[1] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['summer'], lineWidth: 3, originalLineWidth: 3, opacity: 1, type: memo.trendType, 'degree': 2, visibleInLegend: false }; | ||
memo.options.trendlines[2] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['winter'], lineWidth: 3, originalLineWidth: 3, opacity: 1, type: memo.trendType, 'degree': 2, visibleInLegend: false }; | memo.options.trendlines[2] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['winter'], lineWidth: 3, originalLineWidth: 3, opacity: 1, type: memo.trendType, 'degree': 2, visibleInLegend: false }; | ||
} else if ( memo.divide == 'summerother' ) { | |||
memo.options.trendlines[0] = { 'lineWidth': 0, 'opacity': 0, tooltip: false, visibleInLegend: false }; | |||
memo.options.trendlines[1] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['summer'], lineWidth: 3, originalLineWidth: 3, opacity: 1, type: memo.trendType, 'degree': 2, visibleInLegend: false }; | |||
} else if ( memo.divide == 'bottomsurface' ) { | } else if ( memo.divide == 'bottomsurface' ) { | ||
memo.options.trendlines[0] = { 'lineWidth': 0, 'opacity': 0, tooltip: false, visibleInLegend: false }; | memo.options.trendlines[0] = { 'lineWidth': 0, 'opacity': 0, tooltip: false, visibleInLegend: false }; | ||
| Rivi 1 143: | Rivi 1 232: | ||
} | } | ||
for ( var t in memo.options.trendlines ) { | |||
if ( memo.trendType == 'linear' ) { | |||
memo.options.trendlines[ t ].type = 'linear'; | |||
} else if ( memo.trendType = 'poly2deg' ) { | |||
memo.options.trendlines[ t ].type = 'polynomial'; | |||
memo.options.trendlines[ t ].degree = 2; | |||
} else if ( memo.trendType = 'poly3deg' ) { | |||
memo.options.trendlines[ t ].type = 'polynomial'; | |||
memo.options.trendlines[ t ].degree = 3; | |||
} else if ( memo.trendType == 'smart' ) { | |||
if ( ( memo.axisMaxDate.getFullYear() - memo.axisMinDate.getFullYear() > 10 ) && memo.obsesTotal > 20 ) { | if ( ( memo.axisMaxDate.getFullYear() - memo.axisMinDate.getFullYear() > 10 ) && memo.obsesTotal > 20 ) { | ||
memo.options.trendlines[ t ].type = 'polynomial'; | memo.options.trendlines[ t ].type = 'polynomial'; | ||
| Rivi 1 154: | Rivi 1 249: | ||
} | } | ||
} | } | ||
} | } | ||
} | } | ||
| Rivi 1 168: | Rivi 1 263: | ||
memo.dataA.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, memo.obsesA[o].style, null, memo.obsesA[o].popup, null, null, null, null, null, null, null, null ] ); | memo.dataA.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, memo.obsesA[o].style, null, memo.obsesA[o].popup, null, null, null, null, null, null, null, null ] ); | ||
} | } | ||
} else if ( memo.divide == 'summerother' ) { | |||
if ( memo.obsesA[o].seriesId == 'summer' ) { | |||
memo.dataA.push( [ memo.obsesA[o].obsdatetime, null, null, null, null, memo.obsesA[o].value, memo.obsesA[o].style, null, memo.obsesA[o].popup ] ); | |||
} else { | |||
memo.dataA.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, memo.obsesA[o].style, null, memo.obsesA[o].popup, null, null, null, null ] ); | |||
} | |||
} else if ( memo.divide == 'bottomsurface' ) { | } else if ( memo.divide == 'bottomsurface' ) { | ||
if ( memo.obsesA[o].seriesId == 'bottom' ) { | if ( memo.obsesA[o].seriesId == 'bottom' ) { | ||
| Rivi 1 270: | Rivi 1 371: | ||
if ( memo.seasonsA.length == 1 && memo.seasonsA[0] == memo.curSeason ) { | if ( memo.seasonsA.length == 1 && memo.seasonsA[0] == memo.curSeason ) { | ||
memo.options.series[ sc-1 ].lineWidth = 0; | memo.options.series[ sc-1 ].lineWidth = 0; | ||
memo.options.series[ sc-1 ].pointSize = 0; | memo.options.series[ sc-1 ].pointSize = 0; | ||
| Rivi 1 298: | Rivi 1 398: | ||
// make week averages | // make week averages | ||
memo.avgW = {}; | memo.avgW = {}; | ||
for ( var o in memo.obsesA ) { | for ( var o in memo.obsesA ) { | ||
mwDate = new Date( memo.obsesA[o].compareDate.getTime() ); | mwDate = new Date( memo.obsesA[o].compareDate.getTime() ); | ||
mwDate.setDate( mwDate.getDate() - mwDate.getDay() + 3 ); | mwDate.setDate( mwDate.getDate() - mwDate.getDay() + 3 ); | ||
| Rivi 1 309: | Rivi 1 407: | ||
v = memo.obsesA[o].value + memo.distF*Math.random() - memo.distF*Math.random(); | v = memo.obsesA[o].value + memo.distF*Math.random() - memo.distF*Math.random(); | ||
if ( memo.season == 'winter' && w == 1 && y == memo.curSeason ) { y++; } | |||
if ( typeof memo.avgW[y] == 'undefined' ) { memo.avgW[y] = {}; } | if ( typeof memo.avgW[y] == 'undefined' ) { memo.avgW[y] = {}; } | ||
if ( typeof memo.avgW[y][w] == 'undefined' ) { | if ( typeof memo.avgW[y][w] == 'undefined' ) { | ||
memo.avgW[y][w] = { cDate: mwDate, values: [ v ], sum: v, count: 1, avg: v }; | memo.avgW[y][w] = { cDate: mwDate, values: [ v ], sum: v, count: 1, avg: v }; | ||
} else { | } else { | ||
| Rivi 1 525: | Rivi 1 624: | ||
dataRow[s*4+3] = obs.popup; | dataRow[s*4+3] = obs.popup; | ||
if ( ( today.getTime() - obs.compareDate.getTime() < 10*24*60*60*1000 ) && s == 0 && o == ( memo.seasonsO[memo.seasonsA[s]].obses.length - 1 ) ) { | if ( ( today.getTime() - obs.compareDate.getTime() < 10*24*60*60*1000 ) && s == 0 && o == ( memo.seasonsO[memo.seasonsA[s]].obses.length - 1 ) ) { | ||
y = obs.mwDate.getFullYear(); | |||
w = obs.mwDate.getWeek(); | |||
if ( memo.season == 'winter' && w == 1 && y == memo.curSeason ) { y++; } | |||
var diff = obs.value - memo.avgW[ y ][ w ].avg; | |||
var diff = Math.round( diff*100 ); | var diff = Math.round( diff*100 ); | ||
var diffStr = diff.toString() + ' cm'; | var diffStr = diff.toString() + ' cm'; | ||
| Rivi 1 576: | Rivi 1 678: | ||
memo.options.hAxis.ticks.push({v: middleOfMonth, f: i18n.months[m]['roman'] }); | memo.options.hAxis.ticks.push({v: middleOfMonth, f: i18n.months[m]['roman'] }); | ||
} | } | ||
} | |||
if ( memo.obscode == 'level' ) { | |||
memo.options.vAxis.viewWindow.min = Math.floor( memo.obsMinValue * 10 ) / 10; | |||
memo.options.vAxis.viewWindow.max = Math.ceil( memo.obsMaxValue * 10 ) / 10 ; | |||
} | } | ||
//console.log( memo ); | |||
drawChart( memo ); | drawChart( memo ); | ||
| Rivi 1 682: | Rivi 1 791: | ||
} | } | ||
var doResize = function( memo, force = false ) { | var doResize = function( memo, force = false ) { | ||
console.log( 'reize'); | |||
function wait() { | function wait() { | ||
if ( typeof memo.chartEl != 'undefined' && typeof memo.options != 'undefined' ) { | |||
var w = memo.chartEl.width(); | var w = memo.chartEl.width(); | ||
| Rivi 1 750: | Rivi 1 863: | ||
s2 = memo.data.Wf[ o ].c[ 6 ]; | s2 = memo.data.Wf[ o ].c[ 6 ]; | ||
} | } | ||
memo.chart.draw( memo.data, memo.options ); | memo.chart.draw( memo.data, memo.options ); | ||
} | } | ||
} else { | |||
setTimeout( wait, 500 ); | |||
} | |||
} | } | ||
//wait(); | //wait(); | ||
if ( typeof memo.chartEl != 'undefined' ) { | if ( typeof memo.chartEl != 'undefined' ) { | ||
setTimeout( wait, | setTimeout( wait, 100 ); | ||
} | } | ||
| Rivi 1 823: | Rivi 1 938: | ||
var i18n = { | var i18n = { | ||
'surface': { 'fi': 'pinta', 'en': 'surface', 'sv': 'ytan' }, | |||
'bottom': { 'fi': 'pohja', 'en': 'bottom', 'sv': 'bottnet' }, | |||
'siteinfostring': { 'fi': 'Havaintopaikka', 'en': 'Observation site', 'sv': 'Observationsplatsen' }, | |||
'depthinfostring': { 'fi': 'Havainnot syvyydeltä', 'en': 'Depth of observations', 'sv': 'Djup för observationer' }, | |||
'download': { 'fi': 'Lataa csv-muodossa', 'en': 'Download in csv format', 'sv': 'Ladda ner i csv-format' }, | 'download': { 'fi': 'Lataa csv-muodossa', 'en': 'Download in csv format', 'sv': 'Ladda ner i csv-format' }, | ||
'fullscreen': { 'fi': 'Ota käyttöön/poista kokoruututila', 'en': 'Toggle fullscreen mode', 'sv': 'Växla helskärmsläge' }, | 'fullscreen': { 'fi': 'Ota käyttöön/poista kokoruututila', 'en': 'Toggle fullscreen mode', 'sv': 'Växla helskärmsläge' }, | ||
| Rivi 1 841: | Rivi 1 960: | ||
'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' } | 'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' } | ||
}, | }, | ||
'temp': { | 'elodea': { | ||
'type': 'cat', | |||
'min': -0.5, | |||
'season': 'summer', | |||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | |||
'title': { 'fi': 'Vesirutto', 'en': 'Elodea canadensis', 'sv': 'Vattenpest' }, | |||
'catNames': { | |||
0: { 'fi': 'Ei vesiruttoa', 'en': 'No E. canadensis', 'sv': 'Ingen vattenpest' }, | |||
1: { 'fi': 'Hieman vesiruttoa', 'en': 'Some E. canadensis', 'sv': 'Lite med vattenpest' }, | |||
2: { 'fi': 'Runsaasti vesiruttoa', 'en': 'Abundant with E. canadensis', 'sv': 'Rikligt med vattenpest' }, | |||
3: { 'fi': 'Erittäin runsaasti vesiruttoa', 'en': 'Very abundant with E. canadensis', 'sv': 'Ytterst rikligt med vattenpest' } | |||
}, | |||
'catNamesShort': { | |||
0: { 'fi': 'Ei yhtään', 'en': 'None', 'sv': 'Ingen' }, | |||
1: { 'fi': 'Hieman', 'en': 'Some', 'sv': 'Lite' }, | |||
2: { 'fi': 'Runsaasti', 'en': 'Abundant', 'sv': 'Rikligt' }, | |||
3: { 'fi': 'Erit. runsaasti', 'en': 'Very abundant', 'sv': 'Ytterst rikligt' } | |||
}, | |||
'unit': '', | |||
'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' } | |||
}, | |||
'jelly': { | |||
'type': 'cat', | |||
'min': -0.5, | |||
'season': 'summer', | |||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | |||
'title': { 'fi': 'Meduusat', 'en': 'Jelly fish', 'sv': 'Maneter' }, | |||
'catNames': { | |||
0: { 'fi': 'Ei meduusoja', 'en': 'No jelly fish', 'sv': 'Inga maneter' }, | |||
1: { 'fi': 'Vähän meduusoja', 'en': 'Some jelly fish', 'sv': 'Lite med maneter' }, | |||
2: { 'fi': 'Runsaasti meduusoja', 'en': 'Abundant with jelly fish', 'sv': 'Rikligt med maneter' } | |||
}, | |||
'catNamesShort': { | |||
0: { 'fi': 'Ei yhtään', 'en': 'None', 'sv': 'Inga' }, | |||
1: { 'fi': 'Vähän', 'en': 'Some', 'sv': 'Lite' }, | |||
2: { 'fi': 'Runsaasti', 'en': 'Abundant', 'sv': 'Rikligt' } | |||
}, | |||
'unit': '', | |||
'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' } | |||
}, | |||
'trash': { | |||
'type': 'cat', | |||
'min': -0.5, | |||
'season': 'summer', | |||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | |||
'title': { 'fi': 'Roskaisuus', 'en': 'Litter', 'sv': 'Rosk' }, | |||
'catNames': { | |||
0: { 'fi': 'Ei roskia', 'en': 'No litter', 'sv': 'Ingen rosk' }, | |||
1: { 'fi': 'Vähän roskia', 'en': 'Some litter', 'sv': 'Lite med rosk' }, | |||
2: { 'fi': 'Paljon roskia', 'en': 'Abundant with litter', 'sv': 'Rikligt med rosk' }, | |||
3: { 'fi': 'Erittäin paljon roskia', 'en': 'Very abundant with litter', 'sv': 'Ytterst rikligt med rosk' }, | |||
}, | |||
'catNamesShort': { | |||
0: { 'fi': 'Ei yhtään', 'en': 'None', 'sv': 'Inga' }, | |||
1: { 'fi': 'Vähän', 'en': 'Some', 'sv': 'Lite' }, | |||
2: { 'fi': 'Paljon', 'en': 'Abundant', 'sv': 'Rikligt' }, | |||
3: { 'fi': 'Erit. paljon', 'en': 'Very abundant', 'sv': 'Ytterst rikligt' }, | |||
}, | |||
'unit': '', | |||
'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' } | |||
}, | |||
'temp': { | |||
'type': 'num', | 'type': 'num', | ||
'season': 'summer', | 'season': 'summer', | ||
| Rivi 1 956: | Rivi 2 136: | ||
'season': 'summer', | 'season': 'summer', | ||
'min': 0, | 'min': 0, | ||
'max': 110, | |||
'direction': 1, | 'direction': 1, | ||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | ||
'title': { 'fi': 'Hapen kyllästysaste', 'en': 'Oxygen saturation', 'sv': 'Syremättnad | 'title': { 'fi': 'Hapen kyllästysaste', 'en': 'Oxygen saturation', 'sv': 'Syremättnad' }, | ||
'unit': '%', | 'unit': '%', | ||
'axisTitleV': { 'fi': 'Kyllästys-%', 'en': 'Oxygen saturation, %', 'sv': 'Syremättnad, %', 'ru': ' | 'axisTitleV': { 'fi': 'Kyllästys-%', 'en': 'Oxygen saturation, %', 'sv': 'Syremättnad, %' } | ||
}, | }, | ||
'chla': { | |||
'type': 'num', | |||
'season': 'summer', | |||
'min': 0, | |||
'direction': 1, | |||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | |||
'title': { 'fi': 'A-klorofylli', 'en': 'Chlorophyll a', 'sv': 'Klorofyll a', 'ru': '???' }, | |||
'unit': 'µg/l', | |||
'axisTitleV': { 'fi': 'pitoisuus, µg/l', 'en': 'Concentration, µg/l', 'sv': 'Konsentration, µg/l' } | |||
}, | |||
'secchi': { | 'secchi': { | ||
'type': 'num', | 'type': 'num', | ||
| Rivi 2 069: | Rivi 2 260: | ||
'long': { 'fi': 'Elokuu', 'en': 'August', 'sv': 'Augusti', 'ru': '???' }, | 'long': { 'fi': 'Elokuu', 'en': 'August', 'sv': 'Augusti', 'ru': '???' }, | ||
'short': { 'fi': 'Elo', 'en': 'Aug', 'sv': 'Aug', 'ru': '???' }, | 'short': { 'fi': 'Elo', 'en': 'Aug', 'sv': 'Aug', 'ru': '???' }, | ||
'roman': ' | 'roman': 'VIII' | ||
}, | }, | ||
8: { | 8: { | ||


