Ero sivun ”Widget:Test4” versioiden välillä
Järvi-meriwikistä
(21 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 632: | Rivi 632: | ||
var size = 6; | var size = 6; | ||
var line = 0; | var line = 0; | ||
+ | var highlight = true; | ||
if ( memo.seasonsA[ s ].id == memo.curSeason ) { | if ( memo.seasonsA[ s ].id == memo.curSeason ) { | ||
legend = true; color = colors.curObses; | legend = true; color = colors.curObses; | ||
size = 9; | size = 9; | ||
line = 4; | line = 4; | ||
+ | highlight = false; | ||
} | } | ||
− | memo.seriesA.push( { 'type': 'scatter', 'title': memo.seasonsA[ s ].id, 'color': color, 'size': size, 'line': line, 'legend': legend, 'trendline': 'none', obses: [] } ); | + | memo.seriesA.push( { 'type': 'scatter', 'title': memo.seasonsA[ s ].id, 'highlight': highlight, 'color': color, 'size': size, 'line': line, 'legend': legend, 'trendline': 'none', obses: [] } ); |
for ( var o in memo.seasonsA[ s ].obses ) { | for ( var o in memo.seasonsA[ s ].obses ) { | ||
memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | ||
Rivi 648: | Rivi 650: | ||
} | } | ||
} | } | ||
− | memo.seriesA.push( { 'type': 'scatter', 'title': memo.obsMinDate.getFullYear() + '-' + memo.obsMaxDate.getFullYear(), 'color': colors.obses, 'size': 6, 'line': 0, 'legend': true, 'trendline': 'none', obses: [] } ); | + | memo.seriesA.push( { 'type': 'scatter', 'title': memo.obsMinDate.getFullYear() + '-' + memo.obsMaxDate.getFullYear(), 'highlight': false, 'color': colors.obses, 'size': 6, 'line': 0, 'legend': true, 'trendline': 'none', obses: [] } ); |
// make week averages | // make week averages | ||
Rivi 673: | Rivi 675: | ||
memo.avgWA = []; | memo.avgWA = []; | ||
if ( memo.season == 'summer' ) { | if ( memo.season == 'summer' ) { | ||
− | for ( var w=1; w<54; | + | for ( var w=1; w<54; w++ ) { |
if ( typeof memo.avgW[ w ] != 'undefined' ) { memo.avgWA.push( memo.avgW[ w ] ); } | if ( typeof memo.avgW[ w ] != 'undefined' ) { memo.avgWA.push( memo.avgW[ w ] ); } | ||
} | } | ||
Rivi 745: | Rivi 747: | ||
devAvg = devSum/devC; | devAvg = devSum/devC; | ||
− | console.log( memo.avgWA ); | + | //console.log( memo.avgWA ); |
− | memo.seriesA.push( { 'type': 'area', 'title': ' | + | memo.seriesA.push( { 'type': 'area', 'title': i18n[ 'average' ][ memo.lang ], 'highlight': false, 'color': colors.average, 'size': 0, 'line': 2.33, 'legend': true, 'trendline': 'none', obses: [] } ); |
for ( var w in memo.avgWA ) { | for ( var w in memo.avgWA ) { | ||
memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | ||
Rivi 753: | Rivi 755: | ||
'y': memo.avgWA[ w ].hmas, | 'y': memo.avgWA[ w ].hmas, | ||
'style': null, | 'style': null, | ||
− | 'tooltip': '', | + | 'tooltip': i18n[ 'moving' ][ memo.lang ], |
'annotation': null | 'annotation': null | ||
}); | }); | ||
− | } | + | } |
− | /* | + | |
− | memo.seriesA.push( { 'type': 'scatter', 'title': 'Hull', 'color': 'green', 'size': 0, 'line': 2.33, 'legend': true, 'trendline': 'none', obses: [] } ); | + | /* |
+ | memo.seriesA.push( { 'type': 'scatter', 'title': 'Hull', 'highlight': false, 'color': 'green', 'size': 0, 'line': 2.33, 'legend': true, 'trendline': 'none', obses: [] } ); | ||
for ( var w in memo.avgWA ) { | for ( var w in memo.avgWA ) { | ||
memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | memo.seriesA[ memo.seriesA.length - 1 ].obses.push( { | ||
Rivi 766: | Rivi 769: | ||
'y': memo.avgWA[ w ].hmas, | 'y': memo.avgWA[ w ].hmas, | ||
'style': null, | 'style': null, | ||
− | 'tooltip': '', | + | 'tooltip': i18n[ 'moving' ][ memo.lang ], |
'annotation': null | 'annotation': null | ||
}); | }); | ||
Rivi 786: | Rivi 789: | ||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
− | memo.options.series.push( { type: 'line', curveType: 'function', pointType: 'circle', pointSize: memo.seriesA[ s ].size, lineWidth: memo.seriesA[ s ].line, 'color': memo.seriesA[ s ].color, 'visibleInLegend': memo.seriesA[ s ].legend } ); | + | memo.options.series.push( { label: memo.seriesA[ s ].title, type: 'line', curveType: 'function', pointType: 'circle', pointSize: memo.seriesA[ s ].size, lineWidth: memo.seriesA[ s ].line, 'color': memo.seriesA[ s ].color, 'visibleInLegend': memo.seriesA[ s ].legend, highlight: memo.seriesA[ s ].highlight } ); |
if ( memo.seriesA[ s ].trendline != 'none' ) { | if ( memo.seriesA[ s ].trendline != 'none' ) { | ||
Rivi 804: | Rivi 807: | ||
memo.data.addColumn( { type: 'string', role: 'annotation' } ); | memo.data.addColumn( { type: 'string', role: 'annotation' } ); | ||
− | memo.options.series.push( { type: 'area', curveType: 'function', pointType: 'circle', pointSize: memo.seriesA[ s ].size, lineWidth: memo.seriesA[ s ].line, 'color': memo.seriesA[ s ].color, 'areaOpacity': 0.8, 'visibleInLegend': memo.seriesA[ s ].legend } ); | + | memo.options.series.push( { label: memo.seriesA[ s ].title, type: 'area', curveType: 'function', pointType: 'circle', pointSize: memo.seriesA[ s ].size, lineWidth: memo.seriesA[ s ].line, 'color': memo.seriesA[ s ].color, 'areaOpacity': 0.8, 'visibleInLegend': memo.seriesA[ s ].legend, highlight: memo.seriesA[ s ].highlight } ); |
if ( memo.seriesA[ s ].trendline != 'none' ) { | if ( memo.seriesA[ s ].trendline != 'none' ) { | ||
Rivi 848: | Rivi 851: | ||
} | } | ||
− | } | + | } |
+ | |||
+ | console.log( memo.dataA ); | ||
// make ticks for x axis | // make ticks for x axis | ||
Rivi 886: | Rivi 891: | ||
} | } | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
drawChart(memo); | drawChart(memo); | ||
Rivi 952: | Rivi 909: | ||
memo.downloadEl.fadeIn( "slow" ); | memo.downloadEl.fadeIn( "slow" ); | ||
− | memo.selectedCol = | + | memo.selectedCol = -1; |
google.visualization.events.addListener( memo.chart, 'select', function () { | google.visualization.events.addListener( memo.chart, 'select', function () { | ||
+ | |||
+ | for ( var c in memo.options.series ) { | ||
+ | if ( memo.options.series[c].highlight ) { | ||
+ | memo.options.series[c].lineWidth = 0; | ||
+ | //memo.options.series[c].pointSize = memo.options.series[c].origSize; | ||
+ | memo.options.series[c].color = colors['obses']; | ||
+ | memo.options.series[c].visibleInLegend = false; | ||
+ | } | ||
+ | } | ||
var selection = memo.chart.getSelection(); | var selection = memo.chart.getSelection(); | ||
− | if (selection.length > 0) { | + | if ( selection.length > 0 ) { |
− | + | ||
var col = selection[0].column; | var col = selection[0].column; | ||
− | + | var sLabel = memo.data.getColumnLabel( selection[0].column ); | |
− | for (var c in memo.options.series) { | + | var sSeries = ''; |
− | if (memo.options.series[c]. | + | |
− | + | for (var c in memo.options.series) { | |
− | + | if ( memo.options.series[c].label == sLabel ) { | |
− | + | sSeries = c; break; | |
− | + | } | |
− | } | ||
} | } | ||
− | + | ||
− | if (col != memo.selectedCol && memo.options.series[ | + | if ( col != memo.selectedCol && memo.options.series[c].highlight ) { |
memo.selectedCol = col; | memo.selectedCol = col; | ||
− | memo.options.series[ | + | memo.options.series[ sSeries ].lineWidth = 3; |
//memo.options.series[(col-1)/4].pointSize = 12; | //memo.options.series[(col-1)/4].pointSize = 12; | ||
− | memo.options.series[ | + | memo.options.series[ sSeries ].color = colors[ 'selObses' ]; |
− | memo.options.series[ | + | memo.options.series[ sSeries ].visibleInLegend = true; |
} else { | } else { | ||
− | memo.selectedCol = | + | memo.selectedCol = -1; |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
− | + | doResize(); | |
}); | }); | ||
Rivi 1 055: | Rivi 1 007: | ||
if ( i18n[memo.obscode].type == 'num' ) { | if ( i18n[memo.obscode].type == 'num' ) { | ||
+ | |||
+ | headerCols.push( i18n[ 'Date' ][ memo.lang ] ); | ||
+ | headerCols.push( i18n[ 'Time' ][ memo.lang ] ); | ||
+ | headerCols.push( i18n[ 'Observation' ][ memo.lang ] ); | ||
+ | headerCols.push( i18n[ 'Value' ][ memo.lang ] ); | ||
+ | headerCols.push( i18n[ 'ValueUnit' ][ memo.lang ] ); | ||
+ | headerCols.push( i18n[ 'Additionalinfo' ][ memo.lang ] ); | ||
+ | headerCols.push( i18n[ 'Image' ][ memo.lang ] ); | ||
+ | headerCols.push( i18n[ 'ObserverStatus' ][ memo.lang ] ); | ||
− | + | header += headerCols.join( ';' ); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | header += headerCols.join( | ||
for ( var o in memo.obses ) { | for ( var o in memo.obses ) { | ||
Rivi 1 069: | Rivi 1 023: | ||
csvCols = []; | csvCols = []; | ||
− | csvCols.push( memo.obses[o].obsdatetime. | + | csvCols.push( memo.obses[o].obsdatetime.toLocaleDateString( memo.lang ) ); |
− | + | csvCols.push( memo.obses[o].obsdatetime.toLocaleTimeString( memo.lang ) ); | |
− | + | ||
− | + | //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( i18n[ memo ].title[memo.lang ] ); | ||
csvCols.push( '"' + memo.obses[o].value.toString().replace( '.', i18n['dec'][memo.lang] ) + '"' ); | csvCols.push( '"' + memo.obses[o].value.toString().replace( '.', i18n['dec'][memo.lang] ) + '"' ); | ||
csvCols.push( memo.obses[o].addInfo ); | csvCols.push( memo.obses[o].addInfo ); | ||
Rivi 1 323: | Rivi 1 280: | ||
'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': '???' }, | ||
'unit': '°C', | 'unit': '°C', | ||
− | 'axisTitleV': { 'fi': 'Lämpötila, °C', 'en': 'Temperature, °C', 'sv': 'Temperatur, °C', 'ru': '°C' } | + | 'axisTitleV': { 'fi': 'Lämpötila, °C', 'en': 'Temperature, °C', 'sv': 'Temperatur, °C', 'ru': '°C' }, |
+ | 'changes': { | ||
+ | 'fi': 'Pintaveden lämpötilan kuvio on uudistunut.', | ||
+ | 'en': 'The surface water temperature graph has been renewed.', | ||
+ | 'sv': 'Ytvattentemperaturdiagrammet har förnyats.', | ||
+ | 'ru': '' | ||
+ | } | ||
}, | }, | ||
'ice': { | 'ice': { | ||
Rivi 1 336: | Rivi 1 299: | ||
'axisTitleV': { 'fi': 'Jääpeite, cm', 'en': 'Ice cover, cm', 'sv': 'Istäcket, cm', 'ru': 'm' }, | 'axisTitleV': { 'fi': 'Jääpeite, cm', 'en': 'Ice cover, cm', 'sv': 'Istäcket, cm', 'ru': 'm' }, | ||
'changes': { | 'changes': { | ||
− | 'fi': 'Jääpeitteen | + | 'fi': 'Jääpeitteen paksuudesta kertova kuvio on uudistunut. Nyt voit esimerkiksi korostaa kuviosta tietyn vuoden kehityksen valitsemalla yksittäisen havainnon.', |
− | 'en': '', | + | 'en': 'The chart showing the thickness of the ice sheet has been renewed. For example, you can now highlight a particular year in the chart by selecting a single observation.', |
− | 'sv': '', | + | 'sv': 'Diagrammet som visar isens tjocklek har förnyats. Till exempel kan du nu markera ett visst år i diagrammet genom att välja en enskild observation.', |
'ru': '' | 'ru': '' | ||
} | } | ||
Rivi 1 401: | Rivi 1 364: | ||
'ObserverStatus': { 'fi': 'Havainnoijan status', 'en': 'Observer status', 'sv': 'Observatörens status', 'ru': '???' }, | 'ObserverStatus': { 'fi': 'Havainnoijan status', 'en': 'Observer status', 'sv': 'Observatörens status', 'ru': '???' }, | ||
'average': { 'fi': 'Keskimäärin', 'en': 'Average', 'sv': 'Genomsnitt', 'ru': '???' }, | 'average': { 'fi': 'Keskimäärin', 'en': 'Average', 'sv': 'Genomsnitt', 'ru': '???' }, | ||
+ | 'moving': { 'fi': 'Liukuva keskiarvo', 'en': 'Moving average', 'sv': 'Glidande medelvärde', 'ru': '???' }, | ||
'trendline': { 'fi': 'Trendiviiva', 'en': 'Trend line', 'sv': 'Trendlinje', 'ru': '???' }, | 'trendline': { 'fi': 'Trendiviiva', 'en': 'Trend line', 'sv': 'Trendlinje', 'ru': '???' }, | ||
'days': { 'fi': 'päivää', 'en': 'days', 'sv': 'dygn', 'ru': '???' }, | 'days': { 'fi': 'päivää', 'en': 'days', 'sv': 'dygn', 'ru': '???' }, |