Ero sivun ”Widget:JwObsCharts” versioiden välillä
Järvi-meriwikistä
(336 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 1: | Rivi 1: | ||
<includeonly> | <includeonly> | ||
+ | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
+ | |||
(function() { | (function() { | ||
Rivi 13: | Rivi 15: | ||
} | } | ||
} | } | ||
− | setTimeout( | + | setTimeout( <!--{$id|default:TheGraph|escape:'html'}-->_jQueryTest, 300); |
function <!--{$id|default:TheGraph|escape:'html'}-->_func() { | function <!--{$id|default:TheGraph|escape:'html'}-->_func() { | ||
if ( typeof window.jwobschart == 'undefined' ) { | if ( typeof window.jwobschart == 'undefined' ) { | ||
− | + | ||
window.jwobschart = {}; | window.jwobschart = {}; | ||
Rivi 27: | Rivi 29: | ||
jQuery.getScript( '//www.gstatic.com/charts/loader.js', function() { | jQuery.getScript( '//www.gstatic.com/charts/loader.js', function() { | ||
google.charts.load( 'current', { 'packages':[ 'corechart' ], 'language': 'fi' } ); | google.charts.load( 'current', { 'packages':[ 'corechart' ], 'language': 'fi' } ); | ||
− | google.charts.setOnLoadCallback( | + | google.charts.setOnLoadCallback( allReady ); |
}); | }); | ||
}); | }); | ||
}); | }); | ||
} | } | ||
+ | } | ||
+ | |||
+ | function allReady() { | ||
+ | |||
+ | // resize all when window resizes | ||
+ | jQuery( window ).resize(function() { | ||
+ | for ( var c in window.jwobschart ) { | ||
+ | if ( window.jwobschart[c].memo.widgetEl.is( ':visible' ) ) { | ||
+ | doResize( window.jwobschart[c].memo ); | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | loadObservations(); | ||
} | } | ||
function loadObservations() { | function loadObservations() { | ||
+ | |||
+ | var hc = 0; | ||
jQuery( '.jwChartWidget' ).each( function() { | jQuery( '.jwChartWidget' ).each( function() { | ||
Rivi 40: | Rivi 58: | ||
var el = jQuery( this ); | var el = jQuery( this ); | ||
var id = el.attr( 'id' ); if ( typeof id == 'undefined' ) { id = 'jwsitegraph_' + Math.random() + '_container'; el.attr( 'id', id ); } | var id = el.attr( 'id' ); if ( typeof id == 'undefined' ) { id = 'jwsitegraph_' + Math.random() + '_container'; el.attr( 'id', id ); } | ||
− | + | ||
− | if ( el. | + | if ( typeof el.attr( 'data-preload' ) == 'undefined' ) { |
− | + | preload = false; | |
− | + | } else { | |
+ | preload = ( el.attr( 'data-preload' ).toLowerCase() == 'true' ); | ||
+ | } | ||
+ | if ( ( preload || el.is( ':visible' ) ) && typeof window.jwobschart[id] == 'undefined' ) { | ||
+ | |||
window.jwobschart[id] = {}; | window.jwobschart[id] = {}; | ||
− | + | ||
− | var memo = {}; | + | var memo = { "distF": 0 }; window.jwobschart[id].memo = memo; |
memo.widgetEl = jQuery( this ); | memo.widgetEl = jQuery( this ); | ||
− | memo.lang = memo.widgetEl.attr( 'data-lang' ); if (typeof memo.lang == 'undefined') { memo.lang = 'fi'; } | + | memo.lang = memo.widgetEl.attr( 'data-lang' ); if (typeof memo.lang == 'undefined') { memo.lang = 'fi'; } |
memo.height = memo.widgetEl.attr( 'data-height' ); if (typeof memo.height == 'undefined') { memo.height = 450; } | memo.height = memo.widgetEl.attr( 'data-height' ); if (typeof memo.height == 'undefined') { memo.height = 450; } | ||
− | memo.siteid = jQuery( this ).attr( 'data-jw-siteid' ); | + | memo.siteid = jQuery( this ).attr( 'data-jw-siteid' ); if ( typeof memo.siteid == 'undefined' ) { memo.siteid = '-'; } |
− | memo.obscode = jQuery( this ).attr( 'data-jw-obscode' ); | + | memo.waterbody = jQuery( this ).attr( 'data-jw-waterbody' ); if ( typeof memo.waterbody == 'undefined' ) { memo.waterbody = '-'; } |
+ | memo.obscode = jQuery( this ).attr( 'data-jw-obscode' ); if ( typeof memo.obscode == 'undefined' ) { memo.obscode = '-'; } | ||
+ | if ( typeof i18n[ memo.obscode ] == 'undefined' ) { i18n[ memo.obscode ] = i18n.obs; } | ||
+ | memo.refcode = jQuery( this ).attr( 'data-jw-refcode' ); if ( typeof memo.refcode == 'undefined' ) { memo.refcode = '-'; } | ||
+ | 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. | + | memo.axistitlev = jQuery( this ).attr( 'data-axistitlev' ); if ( typeof memo.axistitlev == 'undefined' ) { memo.axistitlev = i18n[ memo.obscode ][ 'axisTitleV' ][ memo.lang ]; } |
+ | memo.tooltiptitle = jQuery( this ).attr( 'data-tooltiptitle' ); if ( typeof memo.tooltiptitle == 'undefined' ) { memo.tooltiptitle = i18n[ memo.obscode ][ 'title' ][ memo.lang ]; } | ||
+ | memo.info = jQuery( this ).attr( 'data-info' ); if ( typeof memo.info == 'undefined' ) { memo.info = jQuery( this ).attr( 'data-info' ); } | ||
+ | |||
+ | if ( typeof jQuery( this ).attr( 'data-min' ) != 'undefined' ) { i18n[memo.obscode]['min'] = parseInt( jQuery( this ).attr( 'data-min' ) ); } | ||
+ | if ( typeof jQuery( this ).attr( 'data-unit' ) != 'undefined' ) { i18n[memo.obscode]['unit'] = parseInt( jQuery( this ).attr( 'data-unit' ) ); } | ||
+ | |||
+ | if ( typeof jQuery( this ).attr( 'data-start-date' ) != 'undefined' ) { | ||
+ | memo.startDate = jQuery( this ).attr( 'data-start-date' ); | ||
+ | } else if ( typeof jQuery( this ).attr( 'data-start-year' ) != 'undefined' ) { | ||
+ | memo.startDate = jQuery( this ).attr( 'data-start-year' ) + '-01-01'; | ||
+ | } else { | ||
+ | memo.startDate = '1800-01-01'; | ||
+ | } | ||
+ | |||
+ | |||
memo.service = jQuery( this ).attr( 'data-coo311-service_code' ); | memo.service = jQuery( this ).attr( 'data-coo311-service_code' ); | ||
memo.graphType = jQuery( this ).attr( 'data-graph-type' ); | memo.graphType = jQuery( this ).attr( 'data-graph-type' ); | ||
− | |||
− | |||
memo.editUrl = jQuery( this ).attr( 'data-edit-url' ); if (typeof memo.editUrl == 'undefined') { memo.editUrl = '-'; } | memo.editUrl = jQuery( this ).attr( 'data-edit-url' ); if (typeof memo.editUrl == 'undefined') { memo.editUrl = '-'; } | ||
+ | memo.download = true; if ( typeof jQuery( this ).attr( 'data-download' ) != 'undefined' ) { memo.download = ( jQuery( this ).attr( 'data-download' ) == '1' || jQuery( this ).attr( 'data-download' ) == 'true' ); } | ||
+ | |||
memo.csvfile = jQuery( this ).attr( 'data-csv-filename' ); if (typeof memo.csvfile == 'undefined') { memo.csvfile = i18n[ memo.obscode ].title[ memo.lang ] + '_SiteID-' + memo.siteid + '_Downloaded-' + today.toISOString().split( 'T' )[0] + '.csv'; } | memo.csvfile = jQuery( this ).attr( 'data-csv-filename' ); if (typeof memo.csvfile == 'undefined') { memo.csvfile = i18n[ memo.obscode ].title[ memo.lang ] + '_SiteID-' + memo.siteid + '_Downloaded-' + today.toISOString().split( 'T' )[0] + '.csv'; } | ||
if ( typeof jQuery( this ).attr( 'data-maintainer' ) == 'undefined' ) { memo.maintainerShow = false; } | if ( typeof jQuery( this ).attr( 'data-maintainer' ) == 'undefined' ) { memo.maintainerShow = false; } | ||
Rivi 125: | Rivi 166: | ||
memo.fullscreenEl.find( 'button' ).html( '<i class="fas fa-compress"></i>' ); | memo.fullscreenEl.find( 'button' ).html( '<i class="fas fa-compress"></i>' ); | ||
} | } | ||
+ | doResize( memo ); | ||
}); | }); | ||
Rivi 134: | Rivi 176: | ||
} | } | ||
− | // add download data button | + | // add download data button |
− | memo.headerEl.append( '<div class="obschartbutton download-button" style="display: none; margin-left: 10px; float: right; Xbackground-color: rgba( 255, 255, 255, 1 ); border-radius: 50%; Xborder: 1px solid rgba( 0, 0, 0, 0.5 ); Xpadding: 1px;"><button title="' + i18n['download'][memo.lang] + '" style="width: 24px; height: 24px; padding: 0; margin: 0; color: #1B599B; background: none; border: none;"><i class="fas fa-download"></i></button></div>' ); | + | if ( memo.download ) { |
− | + | memo.headerEl.append( '<div class="obschartbutton download-button" style="display: none; margin-left: 10px; float: right; Xbackground-color: rgba( 255, 255, 255, 1 ); border-radius: 50%; Xborder: 1px solid rgba( 0, 0, 0, 0.5 ); Xpadding: 1px;"><button title="' + i18n['download'][memo.lang] + '" style="width: 24px; height: 24px; padding: 0; margin: 0; color: #1B599B; background: none; border: none;"><i class="fas fa-download"></i></button></div>' ); | |
+ | memo.downloadEl = jQuery( this ).find( '.download-button' ); | ||
− | + | memo.downloadEl.on( 'click', function() { | |
− | + | var header = ''; | |
− | + | header += '\uFEFF'; // BOM | |
− | + | var csv = ''; | |
− | + | //csv += '\r\nsep=,\r\n'; | |
− | + | var headerCols = []; | |
− | + | var csvCols = []; | |
− | + | if ( i18n[memo.obscode].type == 'num' ) { | |
− | + | //headerCols.push( i18n[ 'Date' ][ memo.lang ] ); | |
− | + | //headerCols.push( i18n[ 'Date' ][ memo.lang ] ); | |
− | + | headerCols.push( '"' + memo.axistitlev + '"' ); | |
− | + | headerCols.push( 'Lisätiedot' ); | |
− | + | headerCols.push( 'Valokuva' ); | |
− | + | headerCols.push( 'Havainnoijan status' ); | |
+ | |||
+ | header += headerCols.join( i18n['sep'][memo.lang] ); | ||
+ | |||
+ | for ( var o in memo.obses ) { | ||
+ | |||
+ | csvCols = []; | ||
− | + | csvCols.push( memo.obses[o].obsdatetime.getFullYear() + '-' + ( memo.obses[o].obsdatetime.getMonth() + 1 ) + '-' + memo.obses[o].obsdatetime.getDate() ); | |
− | + | if ( memo.obses[o].obsdatetime.getUTCHours() == 0 && memo.obses[o].obsdatetime.getUTCMinutes() == 0 && memo.obses[o].obsdatetime.getUTCSeconds() == 0 ) { | |
+ | csvCols.push( '' ); | ||
+ | } else { | ||
+ | csvCols.push( ( "0" + memo.obses[o].obsdatetime.getUTCHours() ).slice(-2) + ':' + ( "0" + memo.obses[o].obsdatetime.getUTCMinutes() ).slice(-2) ); | ||
+ | } | ||
− | + | csvCols.push( '"' + memo.obses[o].value.toString().replace( '.', i18n['dec'][memo.lang] ) + '"' ); | |
+ | csvCols.push( memo.obses[o].addInfo ); | ||
+ | csvCols.push( '' ); | ||
+ | csvCols.push( memo.obses[o].maintainer ); | ||
− | + | csv += '\r\n' + csvCols.join( i18n['sep'][memo.lang] ); | |
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | + | } else if ( i18n[memo.obscode].type == 'date' ) { | |
− | + | if ( i18n[memo.obscode].season == 'winter' ) { | |
+ | header += i18n[ 'season' ][ i18n[memo.obscode].season ][ memo.lang ]; | ||
+ | } else { | ||
+ | header += i18n[ 'year' ][ memo.lang ]; | ||
+ | } | ||
+ | |||
+ | header += ';' + i18n[ 'Observation' ][ memo.lang ]; | ||
+ | header += ';' + i18n[ 'Value' ][ memo.lang ]; | ||
+ | header += ';' + i18n[ 'ValueUnit' ][ memo.lang ]; | ||
+ | header += ';' + i18n[ 'Additionalinfo' ][ memo.lang ]; | ||
+ | header += ';' + i18n[ 'Image' ][ memo.lang ]; | ||
+ | header += ';' + i18n[ 'ObserverStatus' ][ memo.lang ]; | ||
+ | |||
+ | for ( var s in memo.seriesA ) { | ||
+ | |||
+ | for ( var o in memo.seriesA[ s ].obses ) { | ||
+ | obs = memo.seriesA[ s ].obses[ o ]; | ||
− | + | csv += '\r\n'; | |
− | + | csv += obs.season + '-' + (obs.season+1); | |
− | |||
− | |||
− | |||
− | |||
− | + | csv += ';' + i18n[ memo.seriesA[ s ].id ].title[ memo.lang ]; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | csv += ';' + obs.value; | |
+ | csv += ';' + obs.valueUnit; | ||
+ | |||
+ | csv += ';' + obs.addInfo; | ||
+ | csv += ';'; | ||
+ | csv += ';' + obs.maintainer; | ||
+ | |||
+ | } | ||
− | + | } | |
− | + | } else if ( i18n[memo.obscode].type == 'cat' ) { | |
+ | |||
+ | header += 'Päivämäärä'; | ||
+ | header += ';' + 'Kellonaika'; | ||
+ | header += ';' + i18n[memo.obscode].title[memo.lang]; | ||
+ | header += ';' + i18n[memo.obscode].title[memo.lang]; | ||
+ | header += ';' + utf8StringToUtf16String( 'Lisätiedot' ); | ||
+ | header += ';' + 'Valokuva'; | ||
+ | header += ';' + 'Havainnoijan status'; | ||
+ | |||
+ | for ( var o in memo.obses ) { | ||
csv += '\r\n'; | csv += '\r\n'; | ||
− | csv += | + | csv += memo.obses[o].obsdatetime.toLocaleDateString(); //.toISOString(); |
− | csv += ';' + | + | if ( memo.obses[o].obsdatetime.getUTCHours() == 0 && memo.obses[o].obsdatetime.getUTCMinutes() == 0 && memo.obses[o].obsdatetime.getUTCSeconds() == 0 ) { |
+ | csv += ';'; | ||
+ | } else { | ||
+ | csv += ';' + ( "0" + memo.obses[o].obsdatetime.getUTCHours() ).slice(-2) + ':' + ( "0" + memo.obses[o].obsdatetime.getUTCMinutes() ).slice(-2); | ||
+ | } | ||
− | csv += ';' + | + | csv += ';' + memo.obses[o].value; |
− | csv += ';' + | + | csv += ';' + i18n[memo.obscode].catNames[memo.obses[o].value][memo.lang]; |
− | csv += ';' + | + | csv += ';' + memo.obses[o].addInfo; |
csv += ';'; | csv += ';'; | ||
− | csv += ';' + | + | csv += ';' + memo.obses[o].maintainer; |
} | } | ||
Rivi 219: | Rivi 295: | ||
} | } | ||
− | + | csv = header + csv; | |
− | + | var exportedFilename = memo.csvfile; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | var blob = new Blob( [csv], { type: 'text/csv;charset=utf-16LE;' }); | |
− | + | if (navigator.msSaveBlob) { // IE 10+ | |
− | + | navigator.msSaveBlob(blob, exportedFilename); | |
− | + | } else { | |
− | + | var link = document.createElement("a"); | |
− | + | if (link.download !== undefined) { // feature detection | |
− | if ( | + | // Browsers that support HTML5 download attribute |
− | + | var url = URL.createObjectURL(blob); | |
− | + | link.setAttribute("href", url); | |
− | + | link.setAttribute("download", exportedFilename); | |
+ | link.style.visibility = 'hidden'; | ||
+ | document.body.appendChild(link); | ||
+ | link.click(); | ||
+ | document.body.removeChild(link); | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | } | + | }); |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | } | ||
} | } | ||
Rivi 287: | Rivi 331: | ||
memo.showTrend = ( jQuery( this ).attr( 'data-show-trend' ) != 'false' ); | memo.showTrend = ( jQuery( this ).attr( 'data-show-trend' ) != 'false' ); | ||
− | memo.trendType = jQuery( this ).attr( 'data-trend-type' ); if (typeof memo.trendType == 'undefined') { memo.trendType = i18n[memo.obscode]['trend']['type']; } | + | memo.trendType = jQuery( this ).attr( 'data-trend-type' ); if (typeof memo.trendType == 'undefined') { memo.trendType = i18n[memo.obscode]['trend']['type']; } |
− | |||
− | |||
memo.jw = new jwApi(); | memo.jw = new jwApi(); | ||
− | + | memo.jwR = new jwApi(); | |
+ | |||
var custom = ''; | var custom = ''; | ||
if ( typeof memo.obscodeParts[1] != 'undefined' ) { | if ( typeof memo.obscodeParts[1] != 'undefined' ) { | ||
Rivi 301: | Rivi 344: | ||
} | } | ||
} | } | ||
− | + | ||
− | memo. | + | if ( memo.siteid != '-' ) { |
+ | so = { 'obscode': memo.obscodeParts[0], 'siteid': memo.siteid, 'startdate': memo.startDate, 'custom': custom }; | ||
+ | } else { | ||
+ | so = { 'obscode': memo.obscodeParts[0], 'waterbody': memo.waterbody, 'startdate': memo.startDate, 'custom': custom }; | ||
+ | } | ||
+ | |||
+ | memo.jw.loadObses( so, function( o ) { | ||
memo.obses = memo.jw.obs; | memo.obses = memo.jw.obs; | ||
− | drawVisualization(memo); | + | if ( memo.refcode != '-' ) { |
+ | memo.jwR.loadObses( { "obscode": memo.refcode, "siteid": memo.siteid, "sort": "SiteID", "custom": memo.reffilter }, function( r ) { | ||
+ | memo.refs = memo.jwR.obs; | ||
+ | drawVisualization(memo); | ||
+ | }); | ||
+ | } else { | ||
+ | drawVisualization(memo); | ||
+ | } | ||
}); | }); | ||
} else { | } else { | ||
if ( typeof window.jwobschart[id] == 'undefined' ) { | if ( typeof window.jwobschart[id] == 'undefined' ) { | ||
− | + | hc++; | |
} | } | ||
} | } | ||
}); | }); | ||
+ | |||
+ | if ( hc > 0 ) { | ||
+ | setTimeout( loadObservations, 1000 ); | ||
+ | } | ||
+ | |||
} | } | ||
− | 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 327: | Rivi 389: | ||
interpolateNulls: true, | interpolateNulls: true, | ||
vAxis: { | vAxis: { | ||
− | title: | + | title: memo.axistitlev, |
titleTextStyle: { bold: true, italic: false }, | titleTextStyle: { bold: true, italic: false }, | ||
slantedText: false, | slantedText: false, | ||
Rivi 346: | Rivi 408: | ||
series: [ ], | series: [ ], | ||
trendlines: [ ], | trendlines: [ ], | ||
+ | intervals: { | ||
+ | 'style': 'area' | ||
+ | }, | ||
annotations: { | annotations: { | ||
textStyle: { | textStyle: { | ||
Rivi 379: | Rivi 444: | ||
obs = memo.obses[o]; | obs = memo.obses[o]; | ||
− | + | ||
memo.obsesTotal++; | memo.obsesTotal++; | ||
// 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; | ||
} | } | ||
+ | |||
+ | if ( i18n[ memo.obscode ].valfield != 'val' ) { | ||
+ | obs.value = obs.data[ i18n[memo.obscode].valfield ]; | ||
+ | } | ||
// add season | // add season | ||
Rivi 445: | Rivi 515: | ||
if ( i18n[memo.obscode]['type'] == 'cat') { | if ( i18n[memo.obscode]['type'] == 'cat') { | ||
− | obs.popup +='<b>' + | + | obs.popup +='<b>' + memo.tooltiptitle + ': ' + 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>' + | + | obs.popup +='<b>' + memo.tooltiptitle + '</b> '; |
} else { | } else { | ||
− | obs.popup +='<b>' + | + | obs.popup +='<b>' + memo.tooltiptitle + ': ' + (Math.round(obs.value * 10)/10).toString().replace( '.', i18n['dec'][memo.lang] ) + ' ' + i18n[memo.obscode]['unit'] + '</b> '; |
} | } | ||
Rivi 487: | Rivi 557: | ||
baseSize = 2; | baseSize = 2; | ||
} | } | ||
− | |||
− | |||
if ( memo.maintainerShow ) { maintcol = maintColors[obs.maintainer]; } | if ( memo.maintainerShow ) { maintcol = maintColors[obs.maintainer]; } | ||
Rivi 534: | Rivi 602: | ||
memo.titleEl.html( memo.title ); | memo.titleEl.html( memo.title ); | ||
+ | |||
+ | //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="' + 'asdfsadf' + '">' + '<i class="fa-solid fa-location-dot"></i>' + '</button>' ); | ||
+ | |||
if ( typeof i18n[ memo.obscode ].changes != 'undefined' ) { | if ( typeof i18n[ memo.obscode ].changes != 'undefined' ) { | ||
if ( typeof typeof i18n[ memo.obscode ].changes[ memo.lang ] != 'undefined' ) { | if ( typeof typeof i18n[ memo.obscode ].changes[ memo.lang ] != 'undefined' ) { | ||
Rivi 539: | Rivi 610: | ||
jQuery( '[data-toggle="tooltip"]' ).tooltip(); | jQuery( '[data-toggle="tooltip"]' ).tooltip(); | ||
} | } | ||
− | } | + | } |
+ | |||
+ | if ( typeof memo.info != 'undefined' ) { | ||
+ | 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>' ); | ||
+ | jQuery( '[data-toggle="tooltip"]' ).tooltip(); | ||
+ | } | ||
+ | |||
} | } | ||
− | + | ||
if (memo.graphType == 'trend') { | if (memo.graphType == 'trend') { | ||
addDataToTrendChart(memo); | addDataToTrendChart(memo); | ||
+ | |||
+ | } else if (memo.graphType == 'seasonwithreferences') { | ||
+ | |||
+ | addDataToSeasonWithReferencesChart(memo); | ||
+ | |||
+ | } else if (memo.graphType == 'trendwithhighlow') { | ||
+ | |||
+ | addDataToTrendWithHighLowChart(memo); | ||
} else if (memo.graphType == 'season') { | } else if (memo.graphType == 'season') { | ||
Rivi 566: | Rivi 651: | ||
// sort according to obs date | // sort according to obs date | ||
memo.obsesA.sort( function( a, b ) { return b.obsdatetime - a.obsdatetime; }); | memo.obsesA.sort( function( a, b ) { return b.obsdatetime - a.obsdatetime; }); | ||
+ | |||
+ | if ( typeof memo.info != 'undefined' ) { | ||
+ | addToTitle = ' <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>'; | ||
+ | } else { | ||
+ | addToTitle = ''; | ||
+ | } | ||
if ( memo.obscode == 'level' ) { | if ( memo.obscode == 'level' ) { | ||
Rivi 590: | Rivi 681: | ||
obs = memo.obsesA[0]; | obs = memo.obsesA[0]; | ||
+ | for (var r in memo.refs) { | ||
+ | ref = memo.refs[r]; | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | refdata = JSON.parse( ref.printouts.DataJSON ); | ||
+ | refn = refdata.val/100; | ||
− | diff = obs.value - | + | diff = obs.value - refn; |
diff = Math.round( diff*100 ); | diff = Math.round( diff*100 ); | ||
diffStr = diff.toString() + ' cm'; | diffStr = diff.toString() + ' cm'; | ||
if ( diff > 0 ) { diffStr = '+' + diffStr; } | if ( diff > 0 ) { diffStr = '+' + diffStr; } | ||
+ | |||
+ | var levelsvg = '<?xml version="1.0" encoding="utf-8"?><svg role="img" aria-label="XXX" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background:new 0 0 100 99.6;" xml:space="preserve"><style type="text/css">.st0{fill:#ccc;} .st1{fill:#0076B0;}</style>'; | ||
+ | |||
+ | var levelclass = 'st0'; | ||
+ | if ( diff > 20 ) { levelclass = "st1"; } | ||
+ | levelsvg += '<path class="' + levelclass + '" d="M46.8,1.2c1.9-1.5,4.5-1.5,6.4,0c3.9,3,8.7,5.1,13.5,5.1c4.7,0,9.6-2.1,13.4-5.1l0,0c2.1-1.7,4.9-1.5,6.8,0.3c2.5,2.3,5.6,4.1,8.8,4.9c3,0.8,4.8,4.1,4.2,7.5s-3.7,5.4-6.7,4.7c-4.3-1.1-7.8-3.2-10.1-4.9c-5,3-10.7,5.1-16.4,5.1c-5.5,0-10.5-1.9-14-3.7c-1-0.5-1.9-1-2.7-1.5c-0.8,0.5-1.7,1-2.7,1.5c-3.4,1.8-8.4,3.7-14,3.7c-5.7,0-11.4-2-16.4-5c-2.3,1.6-5.9,3.8-10.1,4.9c-3,0.8-6-1.3-6.7-4.7s1.2-6.7,4.2-7.5c3.1-0.8,6.3-2.6,8.8-4.9c1.9-1.9,4.7-2,6.8-0.3l0,0c3.9,3,8.8,5.1,13.5,5.1C38.1,6.3,42.9,4.2,46.8,1.2z"/>'; | ||
− | + | if ( diff > 10 ) { levelclass = "st1"; } | |
+ | levelsvg += '<path class="' + levelclass + '" d="M53.2,21.5c3.9,3,8.7,5.1,13.5,5.1c4.7,0,9.6-2.1,13.4-5.1l0,0c2.1-1.7,4.9-1.5,6.8,0.3c2.5,2.3,5.6,4.1,8.8,4.9c3,0.8,4.8,4.1,4.2,7.5s-3.7,5.4-6.7,4.7c-4.3-1.1-7.8-3.2-10.1-4.9c-5,3-10.7,5.1-16.4,5.1c-5.5,0-10.5-1.9-14-3.7c-1-0.5-1.9-1-2.7-1.5c-0.8,0.5-1.7,1-2.7,1.5c-3.4,1.8-8.4,3.7-14,3.7c-5.7,0-11.4-2-16.4-5c-2.3,1.6-5.9,3.8-10.1,4.9c-3,0.8-6-1.3-6.7-4.7c-0.7-3.4,1.2-6.7,4.2-7.5c3.1-0.8,6.3-2.6,8.8-4.9c1.9-1.9,4.7-2,6.8-0.3l0,0c3.8,3,8.8,5.1,13.4,5.1c4.8,0,9.6-2.1,13.5-5.1C48.7,19.9,51.3,19.9,53.2,21.5z"/>'; | ||
− | + | if ( diff > 0 ) { levelclass = "st1"; } | |
− | + | levelsvg += '<path class="' + levelclass + '" d="M53.2,41.8c3.9,3,8.7,5.1,13.5,5.1c4.7,0,9.6-2.1,13.4-5.1l0,0c2.1-1.7,4.9-1.5,6.8,0.3c2.5,2.3,5.6,4.1,8.8,4.9c3,0.8,4.8,4.1,4.2,7.5s-3.7,5.4-6.7,4.7c-4.3-1.1-7.8-3.2-10.1-4.9c-5,3-10.7,5.1-16.4,5.1c-5.5,0-10.5-1.9-14-3.7c-1-0.5-1.9-1-2.7-1.5c-0.8,0.5-1.7,1-2.7,1.5c-3.4,1.8-8.4,3.7-14,3.7c-5.7,0-11.4-2-16.4-5c-2.3,1.6-5.9,3.8-10.1,4.9c-3,0.8-6-1.3-6.7-4.7s1.2-6.7,4.2-7.5c3.1-0.8,6.3-2.6,8.8-4.9c1.9-1.9,4.7-2,6.8-0.3l0,0c3.8,3,8.8,5.1,13.4,5.1c4.8,0,9.6-2.1,13.5-5.1C48.7,40.2,51.3,40.2,53.2,41.8z"/>'; | |
− | |||
+ | if ( diff > -10 ) { levelclass = "st1"; } | ||
+ | levelsvg += '<path class="' + levelclass + '" d="M53.2,62.1c3.9,3,8.7,5.1,13.5,5.1c4.7,0,9.6-2.1,13.4-5.1l0,0c2.1-1.7,4.9-1.5,6.8,0.3c2.5,2.3,5.6,4.1,8.8,4.9c3,0.8,4.8,4.1,4.2,7.5c-0.7,3.4-3.7,5.4-6.7,4.7c-4.3-1.1-7.8-3.2-10.1-4.9c-5,3-10.7,5.1-16.4,5.1c-5.5,0-10.5-1.9-14-3.7c-1-0.5-1.9-1-2.7-1.5c-0.8,0.5-1.7,1-2.7,1.5c-3.4,1.8-8.4,3.7-14,3.7c-5.7,0-11.4-2-16.4-5c-2.3,1.6-5.9,3.8-10.1,4.9c-3,0.8-6-1.3-6.7-4.7c-0.7-3.4,1.2-6.7,4.2-7.5c3.1-0.8,6.3-2.6,8.8-4.9c1.9-1.9,4.7-2,6.8-0.3l0,0c3.8,3,8.8,5.1,13.4,5.1c4.8,0,9.6-2.1,13.5-5.1C48.7,60.5,51.3,60.5,53.2,62.1z"/>'; | ||
+ | |||
+ | if ( diff > -20 ) { levelclass = "st1"; } | ||
+ | levelsvg += '<path class="' + levelclass + '" d="M53.2,82.4c3.9,3,8.7,5.1,13.5,5.1c4.7,0,9.6-2.1,13.4-5.1l0,0c2.1-1.7,4.9-1.5,6.8,0.3c2.5,2.3,5.6,4.1,8.8,4.9c3,0.8,4.8,4.1,4.2,7.5c-0.7,3.4-3.7,5.4-6.7,4.7c-4.3-1.1-7.8-3.2-10.1-4.9c-5,3-10.7,5.1-16.4,5.1c-5.5,0-10.5-1.9-14-3.7c-1-0.5-1.9-1-2.7-1.5c-0.8,0.5-1.7,1-2.7,1.5c-3.4,1.8-8.4,3.7-14,3.7c-5.7,0-11.4-2-16.4-5c-2.3,1.6-5.9,3.8-10.1,4.9c-3,0.8-6-1.3-6.7-4.7c-0.7-3.4,1.2-6.7,4.2-7.5c3.1-0.8,6.3-2.6,8.8-4.9c1.9-1.8,4.7-2,6.8-0.3l0,0c3.8,3,8.8,5.1,13.4,5.1c4.8,0,9.6-2.1,13.5-5.1C48.7,80.9,51.3,80.9,53.2,82.4z"/>'; | ||
+ | |||
+ | levelsvg += '</svg>'; | ||
+ | |||
+ | if ( diff > 20 ) { | ||
+ | levelsvg.replace( 'XXX', 'Vedenpinta erittäin korkea' ); | ||
+ | } else if ( diff > 10 ) { | ||
+ | levelsvg.replace( 'XXX', 'Vedenpinta korkea' ); | ||
+ | } else if ( diff > 0 ) { | ||
+ | levelsvg.replace( 'XXX', 'Vedenpinta melko tavanomainen' ); | ||
+ | } else if ( diff > -10 ) { | ||
+ | levelsvg.replace( 'XXX', 'Vedenpinta melko tavanomainen' ); | ||
+ | } else if ( diff > -20 ) { | ||
+ | levelsvg.replace( 'XXX', 'Vedenpinta matala' ); | ||
+ | } else { | ||
+ | levelsvg.replace( 'XXX', 'Vedenpinta erittäin matala' ); | ||
+ | } | ||
+ | |||
+ | memo.widgetEl.html(''); | ||
+ | memo.widgetEl.append( '<h3 style="text-align: center; font-size: 18px; margin-top: 0;">Vedenkorkeus' + addToTitle + '</h3>' ); | ||
+ | memo.widgetEl.append( '<div style="width: 120px; height: 120px; margin: 12px auto; padding: 10px; border-radius: 6px; Xborder: 3px solid rgba( 213, 218, 38, 0.5 );">' + levelsvg + '</div>'); | ||
+ | memo.widgetEl.append( '<p style="text-align: center; line-height: 20px;" class="huomio">' + diffStr + '<br /><span class="Xsmall">(' + obs.obsdatetime.inRelationToToday(memo.lang).toLowerCase() + ')</span></p>' ); | ||
+ | //' + obs.obsdatetime.inRelationToToday(memo.lang) + ' | ||
} else if ( memo.obscode == 'ice' ) { | } else if ( memo.obscode == 'ice' ) { | ||
+ | |||
+ | obs = memo.obsesA[0]; | ||
− | iceT = | + | iceT =obs.value.toString() + ' cm'; |
− | + | memo.widgetEl.html(''); | |
− | memo.widgetEl. | + | memo.widgetEl.append( '<p style="text-align: center; line-height: 20px;" class="huomio">' + obs.obsdatetime.inRelationToToday(memo.lang) + '</p>' ); |
+ | memo.widgetEl.append( '<div style="width: 100px; height: 100px; margin: 0 auto;"><svg style="width: 100px; height: 100px;" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="1.70666in" height="1.70666in" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"viewBox="0 0 1.70666 1.70666" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <style type="text/css"> <![CDATA[ .fil0 {fill:#D9F1FF} .fil1 {fill:#DAEBF6} .fil3 {fill:#EAF3F8} .fil2 {fill:#EDF8FF} ]]> </style> </defs> <g id="Layer_x0020_1"> <metadata id="CorelCorpID_0Corel-Layer"/> <g id="_379292064"> <path id="_379292760" class="fil0" d="M1.40329 1.24609c-0.00840157,0 -0.0159921,-0.00530709 -0.0188386,-0.0133543l-0.175606 -0.498173 -0.0287165 0.120094c-0.00475197,0.0199409 -0.0329843,0.0203937 -0.0386417,0.000917323l-0.0844843 -0.290622 -0.0838858 0.219394c-0.00578346,0.0151614 -0.0262677,0.0173661 -0.0352362,0.00405118l-0.0845315 -0.125091 -0.0845276 0.12511c-0.00902756,0.0133583 -0.0294764,0.011063 -0.035252,-0.00405118l-0.0838858 -0.21939 -0.0844882 0.290622c-0.00549606,0.018878 -0.0337677,0.0194409 -0.0386378,-0.000917323l-0.0287244 -0.120094 -0.175606 0.498169c-0.00683858,0.0194094 -0.0351457,0.0168858 -0.0385512,-0.00332283l-0.0963465 -0.570858 -0.0470787 0.133386c-0.00603937,0.017122 -0.0296969,0.0176575 -0.0370276,0.0016811 -0.0107323,-0.0233858 -0.0905197,-0.192185 -0.0907756,-0.201878l-0.0121339 -0.436732c-0.000314961,-0.0112402 0.00874409,-0.0205512 0.0199843,-0.0205512l1.66607 0c0.0112441,0 0.0202953,0.00931102 0.0199843,0.0205512 -0.00126772,0.045122 -0.0096378,0.435122 -0.0139567,0.444508l-0.0889528 0.194102c-0.00762205,0.0166654 -0.0311772,0.0148976 -0.0370118,-0.0016811l-0.0470945 -0.133386 -0.0963307 0.570839c-0.00161417,0.00958661 -0.0099685,0.0166772 -0.0197205,0.0166772z"/> <path id="_379292832" class="fil1" d="M1.40329 1.24609c-0.00840157,0 -0.0159921,-0.00530709 -0.0188386,-0.0133543l-0.175606 -0.498173 -0.0287165 0.120094c-0.00475197,0.0199409 -0.0329843,0.0203937 -0.0386417,0.000917323l-0.0844843 -0.290622 -0.0838858 0.219394c-0.00578346,0.0151614 -0.0262677,0.0173661 -0.0352362,0.00405118l-0.0845315 -0.125091 -1.5748e-005 2.3622e-005 0 -0.52885 0.833039 0c0.0112441,0 0.0202953,0.00931102 0.0199843,0.0205512 -0.00126772,0.045122 -0.0096378,0.435122 -0.0139567,0.444508l-0.0889528 0.194102c-0.00762205,0.0166654 -0.0311772,0.0148976 -0.0370118,-0.0016811l-0.0470945 -0.133386 -0.0963307 0.570839c-0.00161417,0.00958661 -0.0099685,0.0166772 -0.0197205,0.0166772z"/> <path id="_379293384" class="fil2" d="M0.00429921 0.298594l-0.00398819 -0.143559c-0.000314961,-0.0112402 0.00874409,-0.0205512 0.0199843,-0.0205512l1.66607 0c0.0112441,0 0.0202953,0.00931102 0.0199843,0.0205512 -0.000444882,0.0158346 -0.00176378,0.0741457 -0.00347638,0.143559l-0.183831 0 0 0.0628976c6.29921e-005,0.0635315 -0.0523228,0.10285 -0.100862,0.10285 -0.0555709,0 -0.10052,-0.0458071 -0.10052,-0.103965 -0.0459685,0.0349803 -0.108213,0.025122 -0.141409,-0.0201969 -0.0338425,0.0453346 -0.0970984,0.0549055 -0.14148,0.0205079 0,0.0645945 -0.0522795,0.103654 -0.100925,0.103654 -0.0357362,0 -0.0630157,-0.018878 -0.0801614,-0.0418307 -0.0183189,0.0253583 -0.0477402,0.0418307 -0.0808543,0.0418307 -0.0486417,0 -0.100925,-0.0390748 -0.100925,-0.103654 -0.0444331,0.0343898 -0.107654,0.0248189 -0.14148,-0.0205079 -0.033189,0.0453189 -0.0954449,0.0551732 -0.141409,0.0201969 0,0.13778 -0.201445,0.13598 -0.201445,0.00111417l0 -0.0628976 -0.183276 0z"/> <path id="_379293264" class="fil3" d="M0.853331 0.134484l0.833039 0c0.0112441,0 0.0202953,0.00931102 0.0199843,0.0205512 -0.000444882,0.0158346 -0.00176378,0.0741457 -0.00347638,0.143559l-0.183831 0 0 0.0628976c6.29921e-005,0.0635315 -0.0523228,0.10285 -0.100862,0.10285 -0.0555709,0 -0.10052,-0.0458071 -0.10052,-0.103965 -0.0459685,0.0349803 -0.108213,0.025122 -0.141409,-0.0201969 -0.0338425,0.0453346 -0.0970984,0.0549055 -0.14148,0.0205079 0,0.0645945 -0.0522795,0.103654 -0.100925,0.103654 -0.0357362,0 -0.0630157,-0.018878 -0.0801614,-0.0418307l-0.000358268 0.000488189 0 -0.288516z"/> <path id="_379292544" class="fil0" d="M0.546008 1.30221c-0.0527835,0 -0.0957441,-0.0429567 -0.0957441,-0.095748 0,-0.036685 0.0484291,-0.111787 0.0780315,-0.16826 0.00746063,-0.0142441 0.0279331,-0.0142283 0.0353976,0 0.0296614,0.0565157 0.0780197,0.131618 0.0780315,0.168256 3.14961e-005,0.0527953 -0.0429134,0.095752 -0.0957165,0.095752z"/> <path id="_379292472" class="fil0" d="M0.752256 1.10498c-0.0527835,0 -0.0957441,-0.0429567 -0.0957441,-0.095748 0,-0.0365394 0.0482717,-0.111673 0.0780315,-0.16826 0.00749213,-0.014252 0.0279291,-0.0142323 0.0353976,0 0.0296496,0.0565 0.0780394,0.131602 0.0780394,0.168244 7.87402e-006,0.0528071 -0.042937,0.0957638 -0.0957244,0.0957638z"/> <path id="_379291920" class="fil1" d="M1.16068 1.19411c-0.0527992,0 -0.095748,-0.0429567 -0.095748,-0.095748 0,-0.0367283 0.0484252,-0.111728 0.0780433,-0.168252 0.00748031,-0.0142756 0.0279528,-0.0141929 0.0353976,0 0.0296378,0.0564764 0.0780354,0.13161 0.0780433,0.168248 7.87402e-006,0.0527953 -0.0429449,0.095752 -0.0957362,0.095752z"/> <path id="_379292352" class="fil1" d="M1.4033 1.57217c-0.0527992,0 -0.0957441,-0.0429567 -0.0957441,-0.0957441 0,-0.0366496 0.0484134,-0.11178 0.0780433,-0.168264 0.0074685,-0.0142362 0.0279409,-0.0142362 0.0354016,0 0.0296496,0.0565591 0.0780354,0.131583 0.0780394,0.168264 1.5748e-005,0.0527992 -0.042937,0.0957441 -0.0957402,0.0957441z"/> <path id="_379291944" class="fil0" d="M0.303386 1.57217c-0.0527835,0 -0.0957441,-0.0429567 -0.0957441,-0.0957441 0,-0.0366457 0.0483898,-0.111748 0.0780394,-0.168264 0.00747244,-0.0142402 0.0279331,-0.0142283 0.0354016,0 0.0296693,0.0565315 0.0780276,0.131642 0.0780276,0.168264 7.87402e-006,0.0527992 -0.0429409,0.0957441 -0.0957244,0.0957441z"/> <path id="_379292328" class="fil0" d="M0.121409 1.11937c-0.0527874,0 -0.095748,-0.0429567 -0.095748,-0.095748 0,-0.0365945 0.0483465,-0.111724 0.0780433,-0.16826 0.00747638,-0.0142362 0.0279252,-0.0142441 0.0353976,0 0.0296654,0.0565236 0.0780354,0.13161 0.0780394,0.16826 1.1811e-005,0.0527913 -0.0429488,0.095748 -0.0957323,0.095748z"/> <path id="_379292256" class="fil1" d="M1.5853 1.13601c-0.0528031,0 -0.095748,-0.0429567 -0.095748,-0.095748 0,-0.0366929 0.048437,-0.11176 0.0780433,-0.16826 0.00747244,-0.0142638 0.0279291,-0.0142087 0.0353976,0 0.0296811,0.0564882 0.0780315,0.131677 0.0780315,0.16826 3.93701e-006,0.0528071 -0.0429409,0.095748 -0.0957244,0.095748z"/> </g> </g></svg>'); | ||
memo.widgetEl.append( '<p style="text-align: center; line-height: 20px;" class="huomio">Jäätilanne<br />' + iceT + '</p>' ); | memo.widgetEl.append( '<p style="text-align: center; line-height: 20px;" class="huomio">Jäätilanne<br />' + iceT + '</p>' ); | ||
+ | |||
− | } else { | + | } else if ( memo.obscode == 'ski' ) { |
− | memo.widgetEl.html( '<div style="width: 100px; height: 100px; margin: 0 auto;"><svg style="width: 100px; height: 100px;" Xfill="#fff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 943.01 710.7"><defs><style>.cls-1{fill:#1d1e21;fill-rule:evenodd;}</style></defs><g id="_Ñëîé_2"><path class="cls-1" d="m924.06,669.04c0,15.87-11.49,23.41-26.25,23.41H259.14v18.25h638.68c27.25,0,45.19-13.59,45.19-43.17-.47-9.56-18.76-12.12-18.94,1.51h0Z"/><path class="cls-1" d="m666.6,63.13c0,17.45,6.1,31.93,18.24,44.86,12.94,12.15,27.39,18.24,45.61,18.24s32.7-6.1,45.63-18.24c12.15-12.94,18.27-27.41,18.27-44.86s-6.12-31.93-18.27-44.12c-12.94-12.91-28.13-19.01-45.63-19.01s-32.67,6.12-45.61,19.01c-12.15,12.19-18.24,26.62-18.24,44.12h0Z"/><path class="cls-1" d="m518.95,152.16l-69.79,73.81c-22.53,32.02-68.04,3.51-34.44-34.02l76.63-86.71c6.84-7.59,15.2-11.35,25.85-11.35l135.69,15.61c11.42,0,21.29,3.79,28.9,11.4l83.94,85.43,63.11-65.34c25.92-22.25,55.13,1.98,35.58,29.27l-66.07,69.76c-24.27,26.55-35.16,31.83-53.99,14.99l-39.93-38.49-115.54,131.85,86.36,69.9c.75,1.54,2.28,3.03,3.79,5.35,2.28,2.23,3.79,7.59,6.07,16.71,2.3,9.12.75,18.24-3.02,28.11l-39.35,163.82c-13.66,52.91-71.3,32.88-59.36-11.54l36.95-159.68-111.14-92.43-76.56,77.54c-.74.74-2.3,2.28-4.59,3.77-2.28,1.54-7.61,4.56-15.94,7.63-8.35,3.79-17.5,4.56-28.16,3.82l-158.77-.02c-45.17,3.51-58.15-50.8-7.66-61.6h158.14l205.9-239.38-62.62-8.22h0Z"/><path class="cls-1" d="m334.12,626.16c-12.47,9.84-25.53,5.49-34.67-6.08L14.29,259.16l-14.29,11.33,285.15,360.9c16.87,21.37,38.68,27.02,61.88,8.68,7.24-6.26-2.12-22.22-12.91-13.91h0Z"/></g></svg></div>'); | + | memo.widgetEl.html(''); |
− | memo.widgetEl.append( '<p style="text-align: center; line-height: | + | memo.widgetEl.append( '<p style="text-align: center; line-height: 20px;" class="huomio">29.3.2023</p>' ); |
− | + | memo.widgetEl.append( '<div style="width: 100px; height: 100px; margin: 0 auto;"><svg <svg style="width: 100px; height: 100px;" Xfill="#fff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 943.01 710.7"><defs><style>.cls-1{fill:#1d1e21;fill-rule:evenodd;}</style></defs><g id="_Ñëîé_2"><path class="cls-1" d="m924.06,669.04c0,15.87-11.49,23.41-26.25,23.41H259.14v18.25h638.68c27.25,0,45.19-13.59,45.19-43.17-.47-9.56-18.76-12.12-18.94,1.51h0Z"/><path class="cls-1" d="m666.6,63.13c0,17.45,6.1,31.93,18.24,44.86,12.94,12.15,27.39,18.24,45.61,18.24s32.7-6.1,45.63-18.24c12.15-12.94,18.27-27.41,18.27-44.86s-6.12-31.93-18.27-44.12c-12.94-12.91-28.13-19.01-45.63-19.01s-32.67,6.12-45.61,19.01c-12.15,12.19-18.24,26.62-18.24,44.12h0Z"/><path class="cls-1" d="m518.95,152.16l-69.79,73.81c-22.53,32.02-68.04,3.51-34.44-34.02l76.63-86.71c6.84-7.59,15.2-11.35,25.85-11.35l135.69,15.61c11.42,0,21.29,3.79,28.9,11.4l83.94,85.43,63.11-65.34c25.92-22.25,55.13,1.98,35.58,29.27l-66.07,69.76c-24.27,26.55-35.16,31.83-53.99,14.99l-39.93-38.49-115.54,131.85,86.36,69.9c.75,1.54,2.28,3.03,3.79,5.35,2.28,2.23,3.79,7.59,6.07,16.71,2.3,9.12.75,18.24-3.02,28.11l-39.35,163.82c-13.66,52.91-71.3,32.88-59.36-11.54l36.95-159.68-111.14-92.43-76.56,77.54c-.74.74-2.3,2.28-4.59,3.77-2.28,1.54-7.61,4.56-15.94,7.63-8.35,3.79-17.5,4.56-28.16,3.82l-158.77-.02c-45.17,3.51-58.15-50.8-7.66-61.6h158.14l205.9-239.38-62.62-8.22h0Z"/><path class="cls-1" d="m334.12,626.16c-12.47,9.84-25.53,5.49-34.67-6.08L14.29,259.16l-14.29,11.33,285.15,360.9c16.87,21.37,38.68,27.02,61.88,8.68,7.24-6.26-2.12-22.22-12.91-13.91h0Z"/></g></svg></div>'); | |
+ | memo.widgetEl.append( '<p style="text-align: center; line-height: 22px;" class="huomio">Katuman jäälatu<br />Kunnostettu</p>' ); | ||
− | memo. | + | } else if ( memo.obscode == 'temp' ) { |
+ | |||
+ | var tsum = 0; | ||
+ | var tc = 0; | ||
+ | |||
+ | for ( var o in memo.obsesA ) { | ||
+ | tsum += memo.obsesA[o].data.val; | ||
+ | tc++; | ||
+ | } | ||
− | + | if ( tc > 0 ) { | |
+ | tavg = Math.round( tsum/tc*10 ) / 10; | ||
+ | tstr = tavg.toString().replace( '.', ',' ) + ' °C'; | ||
+ | if ( tc == 1 ) { | ||
+ | tstr += '<br /><span>(' + memo.obsesA[0].obsdatetime.inRelationToToday(memo.lang).toLowerCase() + ')</span>'; | ||
+ | } | ||
+ | up = Math.round( (tavg/33)*50 ); | ||
+ | up = Math.max( up, 0 ); | ||
+ | up = Math.min( up, 50 ); | ||
+ | |||
+ | a1 = 60 - up; | ||
+ | a2 = 9 + up; | ||
+ | } else { | ||
+ | tavg = -1; | ||
+ | tstr = 'Ei tuoreita<br />havaintoja'; | ||
+ | a1 = 60 - 25; | ||
+ | a2 = 9 + 25; | ||
+ | } | ||
− | |||
− | // | + | //up = 10; |
− | + | //hue = 100 * ( 50-up ) / ( 50 ); | |
− | + | //rgb = hslToRgb( (360-hue), 0.8, 0.33 ); | |
− | + | ||
− | + | //console.log( 360-hue ); | |
− | + | //console.log( rgb ); | |
+ | |||
+ | //fill = '#' + rgb[0].toString(16).padStart(2, '0') + rgb[1].toString(16).padStart(2, '0') + rgb[2].toString(16).padStart(2, '0'); | ||
− | + | if ( tavg < 0 ) { fill ='#ccc'; } | |
− | + | else if ( tavg < 10 ) { fill = '#0076b0'; } | |
− | + | else if ( tavg < 20 ) { fill = '#d5da26'; } | |
− | + | else { fill = '#da2626'; } | |
− | + | ||
− | memo. | + | var tsvg = '<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">'; |
+ | tsvg += '<style type="text/css">.tscale{fill:none;stroke:#1E1E1E;stroke-width:2;stroke-miterlimit:10;}.toutline{fill:none;stroke:#1E1E1E;stroke-width:4;stroke-miterlimit:10;}'; | ||
+ | tsvg += '.ttemp{fill:' + fill + ';}'; | ||
+ | tsvg += '</style>'; | ||
+ | tsvg += '<g>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="9" x2="69.5" y2="9"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="25.7" x2="69.5" y2="25.7"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="14.6" x2="66.2" y2="14.6"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="20.1" x2="66.2" y2="20.1"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="42.4" x2="69.5" y2="42.4"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="31.2" x2="66.2" y2="31.2"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="36.8" x2="66.2" y2="36.8"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="59" x2="69.5" y2="59"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="47.9" x2="66.2" y2="47.9"/>'; | ||
+ | tsvg += '<line class="tscale" x1="60.6" y1="53.5" x2="66.2" y2="53.5"/>'; | ||
+ | tsvg += '</g>'; | ||
+ | |||
+ | tsvg += '<path class="ttemp" d="M51.8,69.7V' + a1.toString() + '.3c0-2.1-1.7-3.8-3.8-3.8c-2.1,0-3.8,1.7-3.8,3.8v' + a2.toString() + '.4c-4.7,1.6-8.1,6-8.1,11.3c0,6.6,5.3,11.9,11.9,11.9C54.6,92.9,60,87.5,60,81C60,75.7,56.6,71.2,51.8,69.7z"/>'; | ||
+ | tsvg += '<path class="toutline" d="M56.4,65.5V9.9c0-4.6-3.7-8.4-8.4-8.4h0c-4.6,0-8.4,3.7-8.4,8.4v55.7c-5.5,3-9.2,8.8-9.2,15.4c0,9.7,7.9,17.5,17.5,17.5c9.7,0,17.5-7.9,17.5-17.5C65.6,74.3,61.9,68.5,56.4,65.5z"/>'; | ||
+ | tsvg += '</svg>'; | ||
+ | |||
+ | memo.widgetEl.html(''); | ||
+ | memo.widgetEl.append( '<h3 style="text-align: center; font-size: 18px; margin-top: 0;">Pintaveden lämpötila' + addToTitle + '</h3>' ); | ||
+ | memo.widgetEl.append( '<div style="width: 120px; height: 120px; margin: 10px auto; padding: 10px; border-radius: 6px; Xborder: 3px solid rgba( 213, 218, 38, 0.5 );">' + tsvg + '</div>'); | ||
+ | memo.widgetEl.append( '<p style="text-align: center; line-height: 22px;" class="huomio">' + tstr + '</p>' ); | ||
+ | |||
+ | } else if ( memo.obscode == 'alg' ) { | ||
+ | |||
+ | var asum = 0; | ||
+ | var ac = 0; | ||
+ | |||
+ | for ( var o in memo.obsesA ) { | ||
+ | asum += memo.obsesA[o].data.val; | ||
+ | ac++; | ||
+ | } | ||
− | // do Y axis min and max for this chart type | + | if ( ac > 0 ) { |
− | memo.options.vAxis.minValue = new Date( memo.obsMinCompDate.getTime() ); | + | var aavg = Math.round( asum/ac ); |
− | memo.options.vAxis.minValue.setDate(1); | + | if ( aavg < 0.5 ) { astr = 'Ei sinilevää'; } |
− | memo.options.vAxis.viewWindow.min = memo.options.vAxis.minValue; | + | else if ( aavg < 1.5 ) { astr = 'Hieman sinilevää'; } |
+ | else if ( aavg < 2.5 ) { astr = 'Runsaasti sinilevää'; } | ||
+ | else { astr = 'Erittäin runsaasti sinilevää'; } | ||
+ | if ( ac == 1 ) { | ||
+ | astr += '<br /><span>(' + memo.obsesA[0].obsdatetime.inRelationToToday(memo.lang).toLowerCase() + ')</span>'; | ||
+ | } | ||
+ | } else { | ||
+ | astr = 'Ei tuoreita<br />havaintoja'; | ||
+ | aavg = -1; | ||
+ | } | ||
+ | |||
+ | var asvg = '<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">'; | ||
+ | asvg += '<style type="text/css">.alg0{fill:#0076B0;} .alg1{fill:#D5DA26;} .algx{fill:#ccc;}</style>'; | ||
+ | |||
+ | var rx = 10; | ||
+ | var ry = 10; | ||
+ | |||
+ | for ( var row=0; row<10; row++ ) { | ||
+ | for ( var col=0; col<10; col++ ) { | ||
+ | x = col * 10 + 1; | ||
+ | y = row * 10 + 1; | ||
+ | if ( ac > 0 ) { | ||
+ | if ( Math.random() < ( (aavg) / 3) ) { | ||
+ | aclass = 'alg1'; | ||
+ | } else { | ||
+ | aclass = 'alg0'; | ||
+ | } | ||
+ | } else { | ||
+ | aclass = 'algx'; | ||
+ | } | ||
+ | asvg += '<rect x="' + x.toString() +'" y="' + y.toString() +'" class="' + aclass + '" width="8" height="8"/>'; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | asvg += '</svg>'; | ||
+ | |||
+ | memo.widgetEl.html(''); | ||
+ | memo.widgetEl.append( '<h3 style="text-align: center; font-size: 18px; margin-top: 0;">Sinilevätilanne' + addToTitle + '</h3>' ); | ||
+ | memo.widgetEl.append( '<div style="width: 120px; height: 120px; margin: 10px auto; padding: 10px; border-radius: 6px; Xborder: 3px solid rgba( 213, 218, 38, 0.5 );">' + asvg + '</div>'); | ||
+ | memo.widgetEl.append( '<p style="text-align: center; line-height: 22px;" class="huomio">' + astr + '</p>' ); | ||
+ | } | ||
+ | |||
+ | |||
+ | jQuery( '[data-toggle="tooltip"]' ).tooltip(); | ||
+ | memo.loaderEl.fadeOut( "slow", function() { memo.loaderEl.remove(); } ); | ||
+ | |||
+ | } | ||
+ | |||
+ | function addDataToDateOfYearChart( memo ) { | ||
+ | |||
+ | // do X axis min and max for this chart type | ||
+ | memo.options.hAxis.minValue = new Date( memo.obsMinDateMs ); | ||
+ | if ( memo.season = 'winter' && memo.options.hAxis.minValue.getMonth() < 8 ) { memo.options.hAxis.minValue.setFullYear( memo.options.hAxis.minValue.getFullYear()-1 ); } | ||
+ | memo.options.hAxis.minValue.setMonth(0); | ||
+ | memo.options.hAxis.minValue.setDate(1); | ||
+ | memo.options.hAxis.viewWindow.min = memo.options.hAxis.minValue; | ||
+ | |||
+ | memo.options.hAxis.maxValue = new Date( memo.obsMaxDateMs ); | ||
+ | if ( memo.season = 'winter' && memo.options.hAxis.maxValue.getMonth() > 7 ) { memo.options.hAxis.maxValue.setFullYear( memo.options.hAxis.maxValue.getFullYear()+1 ); } | ||
+ | else { memo.options.hAxis.maxValue.setFullYear( memo.options.hAxis.maxValue.getFullYear()+1 ); } | ||
+ | memo.options.hAxis.maxValue.setMonth(11); | ||
+ | memo.options.hAxis.maxValue.setDate(31); | ||
+ | memo.options.hAxis.viewWindow.max = memo.options.hAxis.maxValue; | ||
+ | |||
+ | // do Y axis min and max for this chart type | ||
+ | memo.options.vAxis.minValue = new Date( memo.obsMinCompDate.getTime() ); | ||
+ | memo.options.vAxis.minValue.setDate(1); | ||
+ | memo.options.vAxis.viewWindow.min = memo.options.vAxis.minValue; | ||
memo.options.vAxis.maxValue = new Date( memo.obsMaxCompDate.getTime() ); | memo.options.vAxis.maxValue = new Date( memo.obsMaxCompDate.getTime() ); | ||
Rivi 732: | Rivi 995: | ||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
− | memo.options.series.push( { type: 'scatter', pointType: 'circle', pointSize: 9, color: memo.seriesA[ s ].color } ); | + | memo.options.series.push( { type: 'scatter', pointType: 'circle', pointSize: 9, color: memo.seriesA[ s ].color, XstrokeWidth: 2, Xstroke: '#000000' } ); |
if ( memo.seriesA[ s ].obses.length > 1 ) { | if ( memo.seriesA[ s ].obses.length > 1 ) { | ||
Rivi 799: | Rivi 1 062: | ||
} | } | ||
− | + | drawChart(memo); | |
− | |||
− | |||
− | + | } | |
− | + | ||
− | + | function addDataToSeasonWithReferencesChart(memo) { | |
− | |||
− | |||
+ | // do axis min and max | ||
+ | memo.axisMinDate = new Date( memo.curSeason, 0, 1 ); | ||
+ | memo.axisMaxDate = new Date( memo.curSeason, 11, 31 ); | ||
− | + | memo.data.addColumn( 'number', memo.obsMinYear + '-' + memo.obsMaxYear ); | |
− | + | memo.data.addColumn( { id:'i0', type:'number', role:'interval' } ); | |
+ | memo.data.addColumn( { id:'i0', type:'number', role:'interval' } ); | ||
+ | memo.data.addColumn( {'type': 'string', 'role': 'style' } ); | ||
+ | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
+ | memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | ||
− | + | // series for trend line | |
− | + | //memo.options.trendlines[0] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['trend'], lineWidth: 2, opacity: 0.5, type: 'linear', visibleInLegend: memo.trendType!='moving' }; | |
+ | console.log( memo.obsesA ); | ||
+ | for (var o in memo.obsesA) { | ||
+ | dateStr = memo.obsesA[o].popup.match( /\([^)]*\)/g ); | ||
+ | yearStr = dateStr[0].match( /[0-9]{4}/g ); | ||
+ | memo.obsesA[o].popup = memo.obsesA[o].popup.replace( dateStr[0], '(' + yearStr[0] + ')' ); | ||
+ | memo.dataA.push( [ | ||
+ | memo.obsesA[o].obsdatetime, | ||
+ | memo.obsesA[o].value, | ||
+ | memo.obsesA[o].data.low/100, | ||
+ | memo.obsesA[o].data.high/100, | ||
+ | memo.obsesA[o].style, | ||
+ | null, | ||
+ | memo.obsesA[o].popup | ||
+ | ] ); | ||
+ | } | ||
− | + | memo.options.hAxis.ticks = []; | |
− | + | for (i=memo.axisMinDate.getFullYear(); i<=memo.axisMaxDate.getFullYear(); i++) { | |
− | + | middleOfYear = new Date( i, 6, 1 ); | |
− | + | memo.options.hAxis.ticks.push({v: middleOfYear, f: String(i) }); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | |||
+ | memo.options.seriesType = 'line'; | ||
+ | memo.options.series[0] = { type: 'line', pointSize: 3, color: '#3366cc' }; | ||
+ | memo.options.curveType = 'function'; | ||
+ | memo.options.intervals = { 'style': 'area' }; | ||
+ | |||
+ | memo.options.vAxis.viewWindow.min = 80; | ||
+ | memo.options.vAxis.viewWindow.max = 82; | ||
+ | |||
+ | memo.chart = new google.visualization.LineChart( memo.chartEl[0] ); // document.getElementById(memo.id) | ||
+ | |||
drawChart(memo); | drawChart(memo); | ||
+ | } | ||
− | + | function addDataToTrendWithHighLowChart (memo) { | |
− | + | //console.log( 'high low chart'); | |
// do axis min and max | // do axis min and max | ||
Rivi 845: | Rivi 1 129: | ||
memo.data.addColumn( 'number', memo.obsMinYear + '-' + memo.obsMaxYear ); | memo.data.addColumn( 'number', memo.obsMinYear + '-' + memo.obsMaxYear ); | ||
+ | memo.data.addColumn( { id:'i0', type:'number', role:'interval' } ); | ||
+ | memo.data.addColumn( { id:'i0', type:'number', role:'interval' } ); | ||
memo.data.addColumn( {'type': 'string', 'role': 'style' } ); | memo.data.addColumn( {'type': 'string', 'role': 'style' } ); | ||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
Rivi 850: | Rivi 1 136: | ||
// series for trend line | // series for trend line | ||
− | memo.options.trendlines[0] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['trend'], lineWidth: 2, opacity: 0.5, type: 'linear', visibleInLegend: memo.trendType!='moving' }; | + | //memo.options.trendlines[0] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['trend'], lineWidth: 2, opacity: 0.5, type: 'linear', visibleInLegend: memo.trendType!='moving' }; |
+ | //console.log( memo ); | ||
for (var o in memo.obsesA) { | for (var o in memo.obsesA) { | ||
+ | |||
+ | dateStr = memo.obsesA[o].popup.match( /\([^)]*\)/g ); | ||
+ | yearStr = dateStr[0].match( /[0-9]{4}/g ); | ||
+ | memo.obsesA[o].popup = memo.obsesA[o].popup.replace( dateStr[0], '(' + yearStr[0] + ')' ); | ||
+ | memo.dataA.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, memo.obsesA[o].data.low/100, memo.obsesA[o].data.high/100, memo.obsesA[o].style, null, memo.obsesA[o].popup ] ); | ||
+ | } | ||
− | + | memo.options.hAxis.ticks = []; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | memo.options.hAxis.ticks = []; | ||
for (i=memo.axisMinDate.getFullYear(); i<=memo.axisMaxDate.getFullYear(); i++) { | for (i=memo.axisMinDate.getFullYear(); i<=memo.axisMaxDate.getFullYear(); i++) { | ||
middleOfYear = new Date( i, 6, 1 ); | middleOfYear = new Date( i, 6, 1 ); | ||
Rivi 876: | Rivi 1 154: | ||
} | } | ||
− | memo.options.series[0] = {type: ' | + | memo.options.seriesType = 'line'; |
− | + | memo.options.series[0] = { type: 'line', pointSize: 3, color: '#3366cc' }; | |
+ | memo.options.curveType = 'function'; | ||
+ | memo.options.intervals = { 'style': 'area' }; | ||
+ | |||
+ | memo.options.vAxis.viewWindow.min = 80; | ||
+ | memo.options.vAxis.viewWindow.max = 82; | ||
+ | |||
+ | |||
+ | memo.chart = new google.visualization.LineChart( memo.chartEl[0] ); // document.getElementById(memo.id) | ||
+ | |||
drawChart(memo); | drawChart(memo); | ||
− | } | + | } |
− | function | + | function addDataToTrendChart(memo) { |
− | memo.axisMinDate = new Date( memo. | + | // do axis min and max |
− | + | memo.axisMinDate = new Date(memo.obsMinDate.getTime()); | |
− | memo.axisMaxDate = new Date( memo. | + | memo.axisMaxDate = new Date(memo.obsMaxDate.getTime()); |
− | memo. | + | memo.axisMinDate.setMonth(0); |
− | memo.axisMaxDate.setDate( | + | memo.axisMaxDate.setMonth(11); |
+ | memo.axisMinDate.setDate(1); | ||
+ | memo.axisMaxDate.setDate(31); | ||
− | memo. | + | memo.data.addColumn( 'number', memo.obsMinYear + '-' + memo.obsMaxYear ); |
− | memo. | + | memo.data.addColumn( {'type': 'string', 'role': 'style' } ); |
+ | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
+ | memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | ||
− | for | + | // series for trend line |
+ | memo.options.trendlines[0] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['trend'], lineWidth: 2, opacity: 0.5, type: 'linear', visibleInLegend: memo.trendType!='moving' }; | ||
− | |||
− | |||
− | |||
− | |||
− | for (var o in memo. | + | for (var o in memo.obsesA) { |
− | + | //dataRow = []; | |
− | |||
− | |||
− | // | + | //if (!!memo.obsesA[o].addInfo) { |
− | + | //dataArr.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, 0, memo.obsesA[o].value, memo.obsesA[o].value, 'point { size: 5; fill-color: #0076b0; stroke-width: 2; stroke-color: ' + maintColors[memo.obsesA[o].maintainer] + '; }', '', memo.obsesA[o].popup ] ); | |
− | memo. | + | //memo.dataA.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, 'point { size: 5; fill-color: #0076b0; stroke-width: 2; stroke-color: ' + maintColors[memo.obsesA[o].maintainer] + '; }', null, memo.obsesA[o].popup ] ); |
− | + | memo.dataA.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, memo.obsesA[o].style, null, memo.obsesA[o].popup ] ); | |
− | memo. | + | //} else { |
− | } | + | //dataArr.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, 0, memo.obsesA[o].value, memo.obsesA[o].value, 'point { size: 4; fill-color: #5893b0; stroke-width: 2; stroke-color: ' + maintColors[memo.obsesA[o].maintainer] + '; }', '', memo.obsesA[o].popup ] ); |
− | + | //memo.dataA.push( [ memo.obsesA[o].obsdatetime, memo.obsesA[o].value, 'point { size: 4; fill-color: #5893b0; stroke-width: 2; stroke-color: ' + maintColors[memo.obsesA[o].maintainer] + '; }', null, memo.obsesA[o].popup ] ); | |
− | + | //} | |
− | + | ||
− | + | //memo.dataA.push( dataRow ); | |
− | // | ||
− | memo. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | + | memo.options.hAxis.ticks = []; | |
− | memo. | + | for (i=memo.axisMinDate.getFullYear(); i<=memo.axisMaxDate.getFullYear(); i++) { |
− | memo.options.series[ | + | middleOfYear = new Date( i, 6, 1 ); |
+ | memo.options.hAxis.ticks.push({v: middleOfYear, f: String(i) }); | ||
+ | } | ||
+ | |||
+ | memo.options.series[0] = {type: 'scatter', pointSize: 6, color: '#3366cc' }; | ||
− | + | drawChart(memo); | |
− | |||
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | + | function addDataToSeasonChart(memo) { | |
− | |||
− | + | memo.axisMinDate = new Date( memo.obsMinCompDateMs ); | |
− | memo. | + | memo.axisMinDate.setDate(1); |
− | + | memo.axisMaxDate = new Date( memo.obsMaxCompDateMs ); | |
− | memo. | + | memo.axisMaxDate.setMonth( memo.axisMaxDate.getMonth()+1 ); |
+ | memo.axisMaxDate.setDate(0); | ||
− | + | memo.seasonsO = {}; | |
− | + | memo.seasonsA = []; | |
− | + | for (var o in memo.obsesA) { | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | s = memo.obsesA[o].seriesId; | |
− | + | if (typeof memo.seasonsO[s] == 'undefined' ) { memo.seasonsO[s] = { 'obses': [] }; } | |
+ | memo.seasonsO[s].obses.push( memo.obsesA[o] ); | ||
+ | } | ||
− | + | for (var o in memo.seasonsO) { memo.seasonsA.push(o); } memo.seasonsA.sort( function(a,b) { return b-a; } ); | |
− | |||
− | |||
− | + | // create cols for each series | |
− | + | var sc = 0; | |
− | + | ||
− | + | ||
+ | for (var s in memo.seasonsA) { | ||
− | + | // data | |
+ | if ( memo.season == 'summer' ) { | ||
+ | memo.data.addColumn( 'number', memo.seasonsA[s].toString() ); | ||
+ | } else { | ||
+ | memo.data.addColumn( 'number', memo.seasonsA[s].toString() + '-' + (parseInt(memo.seasonsA[s])+1).toString() ); | ||
+ | } | ||
+ | // style | ||
+ | memo.data.addColumn( { type: 'string', role: 'style' } ); | ||
+ | // tooltip | ||
+ | memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); | ||
+ | // annotation | ||
+ | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
− | + | // add to series | |
− | + | if ( memo.seasonsA[s] == memo.curSeason ) { | |
− | memo. | + | if ( memo.type == 'cat' ) { |
− | } else { | + | memo.options.series[sc++] = { type: 'scatter', curveType: 'function', color: colors['curObses'], XpointSize: 3, lineWidth: 0, visibleInLegend: true, hideThis: false, origSize: 10 }; |
− | memo. | + | } else { |
− | + | if ( memo.obscode == 'secchi' ) { | |
− | memo. | + | //console.log('secchi'); |
− | memo. | + | memo.options.series[sc++] = { type: 'area', curveType: 'function', color: colors['curObses'], pointSize: 3, lineWidth: 4, visibleInLegend: true, hideThis: false, origSize: 10 }; |
− | + | } else { | |
+ | memo.options.series[sc++] = { type: 'scatter', curveType: 'function', color: colors['curObses'], XpointSize: 3, lineWidth: 4, visibleInLegend: true, hideThis: false, origSize: 10 }; | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | memo.options.series[sc++] = { type: 'scatter', curveType: 'function', color: colors['obses'], XpointSize: 5, lineWidth: 0, visibleInLegend: false, hideThis: true, origSize: 5 }; | ||
} | } | ||
+ | } | ||
− | + | // legend entry for timespan | |
+ | memo.data.addColumn( 'number', memo.obsMinDate.getFullYear() + '-' + memo.obsMaxDate.getFullYear() ); | ||
+ | memo.options.series[sc++] = { type: 'scatter', color: colors['obses'], pointSize: 5, visibleInLegend: true, hideThis: false }; | ||
− | + | // series for average | |
− | + | memo.data.addColumn( 'number', i18n['average'][memo.lang] ); | |
− | + | if ( i18n[memo.obscode].trend.layout == 'area') { | |
− | + | memo.options.series[sc++] = { type: 'area', curveType: 'function', lineWidth: 2, pointSize: 0, color: colors['average'], areaOpacity: 0.25, lineDashStyle: [2,2], enableInteractivity: false, visibleInLegend: memo.trendType=='moving' }; | |
− | + | } else { | |
− | + | memo.options.series[sc++] = { type: 'line', curveType: 'function', lineWidth: 3, pointSize: 5, color: colors['average'], dataOpacity: 0.75, lineDashStyle: [6,3], enableInteractivity: false, visibleInLegend: memo.trendType=='moving' }; | |
− | + | } | |
− | + | memo.data.addColumn( { id: 'dev', type: 'number', role: 'interval' } ); | |
− | + | memo.data.addColumn( { id: 'dev', type: 'number', role: 'interval' } ); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | if ( memo.seasonsA.length == 1 && memo.seasonsA[0] == memo.curSeason ) { | |
− | + | memo.options.series[ sc-1 ].lineWidth = 0; | |
− | + | memo.options.series[ sc-1 ].pointSize = 0; | |
− | + | memo.options.series[ sc-1 ].labelInLegend = false; | |
− | + | memo.options.intervals = { 'style':'none' }; | |
− | + | } | |
− | + | ||
− | + | // series for trend line | |
− | + | memo.data.addColumn( 'number', 'trend' ); | |
+ | //memo.options.trendlines[sc] = { labelInLegend: i18n['trendline'][memo.lang], tooltip: false, color: colors['trend'], lineWidth: 2, opacity: 0.5, type: 'polynomial', degree: 15, visibleInLegend: memo.trendType!='moving' }; | ||
+ | memo.options.series[sc++] = { type: 'scatter', pointSize: 0, enableInteractivity: false, visibleInLegend: false, hideThis: false }; | ||
− | + | // do average | |
+ | if (memo.trendType == 'gaussian') { | ||
− | + | memo.gSmoothing = 4; | |
− | + | if ( i18n[memo.obscode]['type'] == 'cat') { | |
− | + | memo.distF = 0.1; | |
− | + | } else { | |
− | } | + | memo.distF = 0; |
+ | } | ||
− | memo. | + | // sort according to compare date |
+ | memo.obsesA.sort( function( a, b ) { return a.compareDate - b.compareDate; }); | ||
− | // | + | // make week averages |
+ | memo.avgW = {}; | ||
+ | for (var o in memo.obsesA) { | ||
− | + | mwDate = new Date( memo.obsesA[o].compareDate.getFullYear(), memo.obsesA[o].compareDate.getMonth(), memo.obsesA[o].compareDate.getDate() ); | |
− | + | y = mwDate.getFullYear(); | |
− | + | w = mwDate.getWeek(); | |
− | + | v = memo.obsesA[o].value + memo.distF*Math.random() - memo.distF*Math.random(); | |
− | + | if ( typeof memo.avgW[y] == 'undefined' ) { memo.avgW[y] = {}; } | |
− | |||
− | |||
− | + | if ( typeof memo.avgW[y][w] == 'undefined' ) { | |
− | + | mwDate.setDate( mwDate.getDate() - mwDate.getDay() + 3 ) | |
− | + | memo.avgW[y][w] = { cDate: mwDate, values: [ v ], sum: v, count: 1, avg: v }; | |
− | + | } else { | |
− | + | memo.avgW[y][w].values.push( v ); | |
− | + | memo.avgW[y][w].sum += v; | |
− | + | memo.avgW[y][w].count++; | |
+ | memo.avgW[y][w].avg = memo.avgW[y][w].sum / memo.avgW[y][w].count; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // calculate standard deviation | ||
+ | devSum = 0; | ||
+ | devC = 0; | ||
+ | devMax = 0; | ||
+ | for ( var y in memo.avgW ) { | ||
+ | for ( var w in memo.avgW[y] ) { | ||
+ | devC++; | ||
+ | devx = 0; | ||
+ | for (var vi in memo.avgW[y][w].values ) { | ||
+ | devx += Math.pow( (memo.avgW[y][w].values[vi] - memo.avgW[y][w].avg), 2 ); | ||
+ | } | ||
+ | memo.avgW[y][w].dev = Math.sqrt( devx/memo.avgW[y][w].count ); | ||
+ | devSum += memo.avgW[y][w].dev; | ||
+ | devMax = Math.max( memo.avgW[y][w].dev, devMax ); | ||
+ | } | ||
+ | } | ||
− | + | devAvg = devSum/devC; | |
− | // | + | for ( var y in memo.avgW ) { |
+ | for ( var w in memo.avgW[y] ) { | ||
+ | if ( memo.avgW[y][w].count < 5 ) { | ||
+ | //memo.avgW[y][w].dev = Math.max( memo.avgW[y][w].dev, devAvg ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
− | + | memo.avgWlist = []; | |
− | + | for ( var y in memo.avgW ) { | |
− | + | for ( var w in memo.avgW[y] ) { | |
− | + | memo.avgWlist.push( { y: parseInt(y), w: parseInt(w), avg: memo.avgW[y][w].avg, dev: memo.avgW[y][w].dev } ); | |
+ | } | ||
+ | } | ||
+ | memo.avgWlist.sort( function(a, b) { return (a.y*100+a.w) - (b.y*100+b.w); }); | ||
− | + | firstY = memo.avgWlist[0].y; | |
− | + | firstW = memo.avgWlist[0].w; | |
+ | lastY = memo.avgWlist[memo.avgWlist.length-1].y; | ||
+ | lastW = memo.avgWlist[memo.avgWlist.length-1].w; | ||
− | if ( memo.avgW[y][w].count < 2 ) { | + | memo.avgMlist = []; |
+ | memo.avgLlist = []; | ||
+ | memo.avgHlist = []; | ||
+ | |||
+ | for ( var y=firstY; y<=lastY; y++ ) { | ||
+ | |||
+ | if ( y == firstY ) { w1 = firstW; } | ||
+ | else { w1 = 1; } | ||
+ | |||
+ | if ( y == lastY ) { w2 = lastW; } | ||
+ | else { w2 = 52; } | ||
+ | |||
+ | for ( var w=w1; w<=w2; w++) { | ||
+ | |||
+ | //console.log( y + '/' + w ); | ||
+ | |||
+ | if ( typeof(memo.avgW[y][w]) == 'undefined' ) { | ||
+ | |||
+ | memo.avgMlist.push( null ); | ||
+ | memo.avgLlist.push( null ); | ||
+ | memo.avgHlist.push( null ); | ||
+ | |||
+ | |||
+ | } else { | ||
+ | memo.avgMlist.push( memo.avgW[y][w].avg ); | ||
+ | |||
+ | if ( memo.avgW[y][w].count < 2 ) { | ||
d = Math.max( devMax, memo.avgW[y][w].dev ); | d = Math.max( devMax, memo.avgW[y][w].dev ); | ||
} else if ( memo.avgW[y][w].count < 4 ) { | } else if ( memo.avgW[y][w].count < 4 ) { | ||
Rivi 1 157: | Rivi 1 500: | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
dataRow[cc-4] = memo.avgMsmooth[i]; | dataRow[cc-4] = memo.avgMsmooth[i]; | ||
Rivi 1 173: | Rivi 1 512: | ||
} | } | ||
− | |||
− | |||
} else if (memo.trendType == 'moving') { | } else if (memo.trendType == 'moving') { | ||
Rivi 1 184: | Rivi 1 521: | ||
for (var s in memo.seasonsA) { | for (var s in memo.seasonsA) { | ||
+ | |||
+ | //console.log( s ); | ||
for (var o in memo.seasonsO[memo.seasonsA[s]].obses) { | for (var o in memo.seasonsO[memo.seasonsA[s]].obses) { | ||
Rivi 1 199: | Rivi 1 538: | ||
// data for series cols | // data for series cols | ||
if ( memo.seasonsA[s] == memo.curSeason ) { | if ( memo.seasonsA[s] == memo.curSeason ) { | ||
− | dataRow[s*4+1] = obs.value; | + | dataRow[s*4+1] = obs.value; |
} else { | } else { | ||
+ | //console.log( memo.distF ); | ||
dataRow[s*4+1] = obs.value + memo.distF*Math.random() - memo.distF*Math.random(); | dataRow[s*4+1] = obs.value + memo.distF*Math.random() - memo.distF*Math.random(); | ||
} | } | ||
dataRow[s*4+2] = obs.style; | dataRow[s*4+2] = obs.style; | ||
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 ) ) { | ||
− | + | ||
− | var diff = obs.value - memo.avgW[ obs.compareDate.getFullYear() ][ obs.compareDate.getWeek() ].avg; | + | //var diff = obs.value - memo.avgW[ obs.compareDate.getFullYear() ][ obs.compareDate.getWeek() ].avg; |
− | var diff = Math.round( diff*100 ); | + | //var diff = Math.round( diff*100 ); |
− | var diffStr = diff.toString() + ' cm'; | + | //var diffStr = diff.toString() + ' cm'; |
− | if ( diff > 0 ) { diffStr = '+' + diffStr; } | + | //if ( diff > 0 ) { diffStr = '+' + diffStr; } |
dataRow[s*4+4] = null; //diffStr; //annotation | dataRow[s*4+4] = null; //diffStr; //annotation | ||
Rivi 1 222: | Rivi 1 562: | ||
} | } | ||
− | } | + | } |
− | |||
− | |||
// make ticks for x axis | // make ticks for x axis | ||
Rivi 1 241: | Rivi 1 579: | ||
memo.options.hAxis.viewWindow.max = memo.axisMaxDate; | memo.options.hAxis.viewWindow.max = memo.axisMaxDate; | ||
memo.options.hAxis.ticks = []; | memo.options.hAxis.ticks = []; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
for (i=0; i<mCount; i++) { | for (i=0; i<mCount; i++) { | ||
Rivi 1 274: | Rivi 1 604: | ||
} | } | ||
− | |||
function drawChart(memo) { | function drawChart(memo) { | ||
− | + | ||
memo.loaderEl.fadeOut( "slow", function() { memo.loaderEl.remove(); } ); | memo.loaderEl.fadeOut( "slow", function() { memo.loaderEl.remove(); } ); | ||
Rivi 1 284: | Rivi 1 613: | ||
memo.data.addRows(memo.dataA); | memo.data.addRows(memo.dataA); | ||
− | memo.chart = new google.visualization.ComboChart( memo.chartEl[0] ); // document.getElementById(memo.id) | + | if ( typeof memo.chart == 'undefined' ) { |
+ | memo.chart = new google.visualization.ComboChart( memo.chartEl[0] ); // document.getElementById(memo.id) | ||
+ | } | ||
//doResize(); | //doResize(); | ||
memo.fullscreenEl.fadeIn( "slow" ); | memo.fullscreenEl.fadeIn( "slow" ); | ||
− | memo.downloadEl.fadeIn( "slow" ); | + | if ( memo.download) { memo.downloadEl.fadeIn( "slow" ); } |
memo.selectedCol = 0; | memo.selectedCol = 0; | ||
Rivi 1 334: | Rivi 1 665: | ||
} | } | ||
− | doResize(); | + | doResize( memo ); |
}); | }); | ||
− | |||
− | + | } else { | |
+ | |||
+ | jQuery( jQuery( document.getElementById(memo.id) ) ).hide(); | ||
+ | |||
+ | } | ||
− | }); | + | doResize( memo ); |
+ | |||
+ | } | ||
+ | |||
+ | var doResize = function( memo ) { | ||
+ | |||
+ | function wait() { | ||
+ | |||
+ | //console.log( memo ); | ||
+ | |||
+ | var w = memo.chartEl.width(); | ||
+ | var h = memo.chartEl.height(); | ||
+ | |||
+ | //console.log( w ); | ||
+ | |||
+ | if ( typeof memo.oldW == 'undefined' ) { memo.oldW = 1; } | ||
+ | if ( typeof memo.oldH == 'undefined' ) { memo.oldH = 1; } | ||
+ | |||
+ | if ( ( w != memo.oldW || h != memo.oldH ) && w*h != 0 ) { | ||
+ | |||
+ | memo.oldW = w; memo.oldH = h; | ||
− | + | memo.margins = { top: 10, right: 10, bottom: 80, left: 80 }; | |
var w = memo.chartEl.width(); | var w = memo.chartEl.width(); | ||
var h = memo.chartEl.height(); | var h = memo.chartEl.height(); | ||
− | |||
− | |||
− | + | var l = Math.max( memo.margins.left, 0.1*w ); | |
+ | var r = Math.max( memo.margins.right, 0.02*w ); | ||
+ | var t = Math.max( memo.margins.top, 0.02*h ); | ||
+ | var b = Math.max( memo.margins.bottom, 0.15*h ); | ||
− | + | memo.options.chartArea = { top: t, left: l, width: (w - l - r), height: (h - t - b), backgroundColor: { fill: '#fff', stroke: '#eee', strokeWidth: 4 }}; | |
− | |||
− | + | memo.chart.draw( memo.data, memo.options ); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | // hide every second vaxis gridline on cat charts | ||
+ | if ( i18n[memo.obscode]['type'] == 'cat') { | ||
+ | var glc = 0; | ||
+ | jQuery( document.getElementById(memo.id) ).find( 'rect[height="1"]' ).each( function() { | ||
+ | if ( ( glc++ % 2 ) == 0 ) { | ||
+ | jQuery( this ).attr( 'fill', 'none' ); | ||
+ | } | ||
+ | }); | ||
} | } | ||
− | + | // add dash to trendlines | |
+ | jQuery( document.getElementById(memo.id) ).find( 'path[stroke-width="2.33"]' ).each( function() { | ||
+ | jQuery( this ).attr('stroke-dasharray', '5, 5'); | ||
+ | }); | ||
− | + | // move current observations to top | |
− | + | gEl = jQuery( document.getElementById(memo.id) ).find( 'svg' ).append( 'g' ); | |
− | + | jQuery( document.getElementById(memo.id) ).find( 'path[stroke="#3366cc"]' ).detach().appendTo( gEl ); | |
+ | jQuery( document.getElementById(memo.id) ).find( 'circle[fill="#3366cc"]' ).detach().appendTo( gEl ); | ||
+ | jQuery( document.getElementById(memo.id) ).find( 'circle[stroke-width="3"]' ).each( function() { jQuery( this ).parent().append( jQuery( this ) ); }); | ||
+ | } | ||
+ | } | ||
+ | //wait(); | ||
+ | if ( typeof memo.chartEl != 'undefined' ) { | ||
+ | setTimeout( wait, 500 ); | ||
} | } | ||
− | |||
− | |||
} | } | ||
+ | window.jwobschartresize = doResize; | ||
function smooth( list, degree ) { | function smooth( list, degree ) { | ||
Rivi 1 468: | Rivi 1 798: | ||
'dec': { 'fi': ',', 'en': '.', 'sv': ',' }, | 'dec': { 'fi': ',', 'en': '.', 'sv': ',' }, | ||
'sep': { 'fi': '\t', 'en': ' ', 'sv': ' ' }, | 'sep': { 'fi': '\t', 'en': ' ', 'sv': ' ' }, | ||
+ | 'obs': { | ||
+ | 'type': 'num', | ||
+ | 'season': 'summer', | ||
+ | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | ||
+ | 'title': { 'fi': '', 'en': '', 'sv': '', 'ru': '' }, | ||
+ | 'unit': '', | ||
+ | 'axisTitleV': { 'fi': '', 'en': '', 'sv': '', 'ru': '' } | ||
+ | }, | ||
'alg': { | 'alg': { | ||
'type': 'cat', | 'type': 'cat', | ||
Rivi 1 482: | Rivi 1 820: | ||
'type': 'num', | 'type': 'num', | ||
'season': 'summer', | 'season': 'summer', | ||
+ | //'min': 0, | ||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | ||
'title': { 'fi': 'Pintaveden lämpötila', 'en': 'Surface water termperature', 'sv': 'Ytvattentemperatur', 'ru': '???' }, | 'title': { 'fi': 'Pintaveden lämpötila', 'en': 'Surface water termperature', 'sv': 'Ytvattentemperatur', 'ru': '???' }, | ||
Rivi 1 521: | Rivi 1 860: | ||
'snow_load': { | 'snow_load': { | ||
'catName': 'Lumikuorma', | 'catName': 'Lumikuorma', | ||
+ | 'valfield': 'load', | ||
'type': 'num', | 'type': 'num', | ||
'season': 'winter', | 'season': 'winter', | ||
'min': 0, | 'min': 0, | ||
− | 'trend': { 'type': ' | + | 'trend': { 'type': 'gaussian', 'layout': 'line' }, |
'title': { 'fi': 'Lumikuorma', 'en': 'Snow load', 'sv': 'Snöbelastning', 'ru': '???' }, | 'title': { 'fi': 'Lumikuorma', 'en': 'Snow load', 'sv': 'Snöbelastning', 'ru': '???' }, | ||
'unit': 'kg/m²', | 'unit': 'kg/m²', | ||
'axisTitleV': { 'fi': 'Lumikuorma, kg/m²', 'en': 'Snow load, kg/m²', 'sv': 'Snöbelastning, kg/m²', 'ru': 'm' } | 'axisTitleV': { 'fi': 'Lumikuorma, kg/m²', 'en': 'Snow load, kg/m²', 'sv': 'Snöbelastning, kg/m²', 'ru': 'm' } | ||
}, | }, | ||
− | 'ptot': { | + | 'snow': { |
+ | 'catName': 'Lumen syvyys', | ||
+ | 'type': 'num', | ||
+ | 'season': 'winter', | ||
+ | 'min': 0, | ||
+ | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | ||
+ | 'title': { 'fi': 'Lumipeitteen paksuus', 'en': 'Snow cover depth', 'sv': 'Snötäckets tjockhet', 'ru': '???' }, | ||
+ | 'unit': 'cm', | ||
+ | 'axisTitleV': { 'fi': 'Lumipeite, cm', 'en': 'Snow cover, cm', 'sv': 'Snötäcket, cm', 'ru': 'm' } | ||
+ | }, | ||
+ | 'ptot': { | ||
'type': 'num', | 'type': 'num', | ||
'season': 'summer', | 'season': 'summer', | ||
Rivi 1 555: | Rivi 1 905: | ||
'direction': 1, | 'direction': 1, | ||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | ||
− | 'title': { 'fi': 'Happipitoisuus', 'en': 'Dissolved oxygen', 'sv': 'Syrehalt', 'ru': '???' }, | + | 'title': { 'fi': 'Happipitoisuus', 'en': 'Dissolved oxygen', 'sv': 'Syrehalt', 'ru': '???' }, |
− | 'unit': 'mg/l', | + | 'unit': 'mg/l', |
− | 'axisTitleV': { 'fi': 'Pitoisuus, mg/l', 'en': 'Concentration, mg/l', 'sv': 'Koncentration, mg/l', 'ru': 'm' } | + | 'axisTitleV': { 'fi': 'Pitoisuus, mg/l', 'en': 'Concentration, mg/l', 'sv': 'Koncentration, mg/l', 'ru': 'm' } |
− | }, | + | }, |
− | 'o2s': { | + | 'o2s': { |
− | 'type': 'num', | + | 'type': 'num', |
− | 'season': 'summer', | + | 'season': 'summer', |
− | 'min': 0, | + | 'min': 0, |
− | 'direction': 1, | + | 'direction': 1, |
− | 'trend': { 'type': 'regression', 'layout': 'line' }, | + | 'trend': { 'type': 'regression', 'layout': 'line' }, |
− | 'title': { 'fi': 'Hapen kyllästysaste', 'en': 'Oxygen saturation', 'sv': 'Syremättnad', 'ru': '???' }, | + | 'title': { 'fi': 'Hapen kyllästysaste', 'en': 'Oxygen saturation', 'sv': 'Syremättnad', 'ru': '???' }, |
− | 'unit': '%', | + | 'unit': '%', |
− | 'axisTitleV': { 'fi': 'Hapen kyllästysaste, %', 'en': 'Oxygen saturation, %', 'sv': 'Syremättnad, %', 'ru': '%' } | + | 'axisTitleV': { 'fi': 'Hapen kyllästysaste, %', 'en': 'Oxygen saturation, %', 'sv': 'Syremättnad, %', 'ru': '%' } |
− | }, | + | }, |
− | 'secchi': { | + | 'secchi': { |
− | 'type': 'num', | + | 'type': 'num', |
− | 'season': 'summer', | + | 'season': 'summer', |
− | 'min': 0, | + | 'min': 0, |
− | 'direction': | + | 'direction': 1, |
− | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | + | 'trend': { 'type': 'gaussian', 'layout': 'line' }, |
− | 'title': { 'fi': 'Näkösyvyys', 'en': 'Water transparency', 'sv': 'Siktdjupet', 'ru': '???' }, | + | 'title': { 'fi': 'Näkösyvyys', 'en': 'Water transparency', 'sv': 'Siktdjupet', 'ru': '???' }, |
+ | 'unit': 'm', | ||
+ | 'axisTitleV': { 'fi': 'Näkösyvyys, m', 'en': 'Secchi depth, m', 'sv': 'Siktdjupet, m', 'ru': 'm' } | ||
+ | }, | ||
+ | 'level': { | ||
+ | 'title': { 'fi': 'Vedenkorkeus', 'en': 'Water level', 'sv': 'Vattenståndpunkt', 'ru': '???' }, | ||
+ | 'title2': { 'fi': 'Vedenkorkeus', 'en': '???', 'sv': '???', 'ru': '???' }, | ||
+ | 'type': 'num', | ||
+ | 'season': 'summer', | ||
+ | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | ||
+ | 'unit': 'm', | ||
+ | 'axisTitleV': { 'fi': 'Vedenpinnan korkeus, m', 'en': 'Water level, m', 'sv': 'Vattennivå, m', 'ru': 'm' } | ||
+ | }, | ||
+ | 'avglevelsy': { | ||
+ | 'title': { 'fi': 'Keskivedenkorkeus', 'en': '', 'sv': '', 'ru': '???' }, | ||
+ | 'title2': { 'fi': 'Vedenkorkeus', 'en': '???', 'sv': '???', 'ru': '???' }, | ||
+ | 'type': 'num', | ||
+ | 'season': 'summer', | ||
+ | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | ||
'unit': 'm', | 'unit': 'm', | ||
− | 'axisTitleV': { 'fi': ' | + | 'axisTitleV': { 'fi': 'Vuosikeskiarvo, m', 'en': 'Water level, m', 'sv': 'Vattennivå, m', 'ru': 'm' } |
}, | }, | ||
− | ' | + | 'avglevelsw': { |
− | 'title': { 'fi': ' | + | 'title': { 'fi': 'Keskivedenkorkeus', 'en': '', 'sv': '', 'ru': '???' }, |
'title2': { 'fi': 'Vedenkorkeus', 'en': '???', 'sv': '???', 'ru': '???' }, | 'title2': { 'fi': 'Vedenkorkeus', 'en': '???', 'sv': '???', 'ru': '???' }, | ||
'type': 'num', | 'type': 'num', | ||
Rivi 1 586: | Rivi 1 954: | ||
'trend': { 'type': 'gaussian', 'layout': 'line' }, | 'trend': { 'type': 'gaussian', 'layout': 'line' }, | ||
'unit': 'm', | 'unit': 'm', | ||
− | 'axisTitleV': { 'fi': ' | + | 'axisTitleV': { 'fi': 'Vuosikeskiarvo, m', 'en': 'Water level, m', 'sv': 'Vattennivå, m', 'ru': 'm' } |
− | }, | + | }, |
'ski': { | 'ski': { | ||
'title': { 'fi': 'Hiihto', 'en': 'Skiing', 'sv': '', 'ru': '???' }, | 'title': { 'fi': 'Hiihto', 'en': 'Skiing', 'sv': '', 'ru': '???' }, |