|
|
| Rivi 633: |
Rivi 633: |
| var color = colors.obses; | | var color = colors.obses; |
| var size = 6; | | var size = 6; |
| | var line = 0; |
| 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; |
| } | | } |
| memo.seriesA.push( { 'type': 'scatter', 'title': memo.seasonsA[ s ].id, 'color': color, 'size': size, 'legend': legend, 'trendline': 'none', obses: [] } ); | | memo.seriesA.push( { 'type': 'scatter', 'title': memo.seasonsA[ s ].id, '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 660: |
Rivi 662: |
| memo.data.addColumn( { type: 'string', role: 'annotation' } ); | | memo.data.addColumn( { type: 'string', role: 'annotation' } ); |
|
| |
|
| memo.options.series.push( { type: 'scatter', pointType: 'circle', pointSize: memo.seriesA[ s ].size, 'color': memo.seriesA[ s ].color, 'visibleInLegend': memo.seriesA[ s ].legend } ); | | memo.options.series.push( { type: 'scatter', pointType: 'circle', pointSize: memo.seriesA[ s ].size, lineWidth: memo.seriesA[ s ].line, 'color': memo.seriesA[ s ].color, 'visibleInLegend': memo.seriesA[ s ].legend } ); |
|
| |
|
| if ( memo.seriesA[ s ].trendline != 'none' ) { | | if ( memo.seriesA[ s ].trendline != 'none' ) { |
| Rivi 711: |
Rivi 713: |
| /* | | /* |
| | | |
| for ( var s in memo.seasonsA ) {
| | |
| memo.seriesA.push( );
| |
| obs = memo.obsesA[ o ];
| |
| s = obs.seriesId;
| |
| if ( typeof memo.seriesO[ s ] == 'undefined' ) {
| |
| memo.seriesO[ s ] = { 'id': s, 'order': parseInt( obs.data.cat ), 'title': i18n[ s ].title[ memo.lang ], 'type': 'scatter', 'color': i18n[ s ].color, 'obses': [] };
| |
| }
| |
| obs.xvalue = obs.seasonmiddle;
| |
| obs.yvalue = obs.compareDate;
| |
| obs.value = obs.obsdatetime.toLocaleDateString( memo.lang );
| |
| obs.valueUnit = i18n[ 'Date' ][ memo.lang ];
| |
| obs.tooltip = '<p><b>' + i18n[ 'season' ][ 'winter' ][ memo.lang ] + ' ' + obs.season + '–' + (obs.season+1) + '</b></p>';
| |
| obs.tooltip += '<p>' + i18n[ s ].title2[ memo.lang ] + ': ' + obs.obsdatetime.toLocaleDateString( memo.lang ) + '</p>';
| |
| obs.tooltip += obs.addInfo;
| |
| memo.seriesO[ s ].obses.push( obs );
| |
| }
| |
| | |
| // create ice cover series
| |
| if ( memo.obscode == 'ice_cat_2,5' ) {
| |
| memo.obsesS = {};
| |
| for ( var o in memo.obsesA ) {
| |
| var obs = memo.obsesA[ o ];
| |
| | |
| if ( typeof memo.obsesS[ obs.season ] == 'undefined' ) {
| |
| memo.obsesS[ obs.season ] = { 'maintainer': obs.maintainer };
| |
| }
| |
| | |
| if ( obs.data.cat == '2' ) {
| |
| memo.obsesS[ obs.season ][ 'low' ] = obs.compareDate;
| |
| } else if ( obs.data.cat == '5' ) {
| |
| memo.obsesS[ obs.season ][ 'high' ] = obs.compareDate;
| |
| }
| |
| if ( memo.obsesS[ obs.season ][ 'maintainer' ] != obs.maintainer ) { memo.obsesS[ obs.season ][ 'maintainer' ] = ''; }
| |
| | |
| if ( typeof memo.obsesS[ obs.season ][ 'low' ] != 'undefined' && typeof memo.obsesS[ obs.season ][ 'high' ] != 'undefined' ) {
| |
| days = Math.round( ( memo.obsesS[ obs.season ][ 'high' ].getTime() - memo.obsesS[ obs.season ][ 'low' ].getTime() ) / ( 1000*60*60*24 ) );
| |
| if ( typeof memo.seriesO[ 'ice_cat_2,5' ] == 'undefined' ) {
| |
| memo.seriesO[ 'ice_cat_2,5' ] = { 'id': 'ice_cat_2,5', 'order': 10, 'title': i18n[ 'ice_cat_2,5' ].title[ memo.lang ], 'type': 'candlestick', 'color': i18n[ 'ice_cat_2,5' ].color, obses: [] };
| |
| }
| |
| memo.seriesO[ 'ice_cat_2,5' ].obses.push( { 'obsdatetime': obs.obsdatetime, 'season': obs.season, 'value': days, 'valueUnit': i18n[ 'days' ][ memo.lang ], 'addInfo': '', 'maintainer': memo.obsesS[ obs.season ][ 'maintainer' ], 'xvalue': obs.seasonmiddle, 'low': memo.obsesS[ obs.season ][ 'low' ], 'high': memo.obsesS[ obs.season ][ 'high' ], 'tooltip': '<p><b>' + i18n[ 'season' ][ 'winter' ][ memo.lang ] + ' ' + obs.season + '–' + (obs.season+1) + '</b></p><p>' + i18n[ 'ice_cat_2,5' ].title[ memo.lang ] + ': ' + days + ' ' + i18n[ 'days' ][ memo.lang ] + '</p>' } );
| |
| }
| |
|
| |
| }
| |
| }
| |
| | |
| memo.seriesA = []; for ( var s in memo.seriesO ) { memo.seriesA.push( memo.seriesO[s] ) };
| |
| memo.seriesA.sort( function( a, b ) { return a.order-b.order; } );
| |
| | |
| for ( var s in memo.seriesA ) {
| |
| | |
| if ( memo.seriesA[ s ].type == 'scatter' ) {
| |
| | |
| memo.data.addColumn( 'date', memo.seriesA[ s ].title ); // + ' ' + memo.obsMinYear + '-' + memo.obsMaxYear );
| |
| memo.data.addColumn( { type: 'string', 'role': 'style' } );
| |
| memo.data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } );
| |
| memo.data.addColumn( { type: 'string', role: 'annotation' } );
| |
| | |
| memo.options.series.push( { type: 'scatter', pointType: 'circle', pointSize: 9, color: memo.seriesA[ s ].color } );
| |
| | |
| if ( memo.seriesA[ s ].obses.length > 1 ) {
| |
| memo.options.trendlines[ memo.options.series.length - 1 ] = { type: 'linear', title: i18n.trendline, lineWidth: 2.33, visibleInLegend: false, tooltip: false };
| |
| } else {
| |
| memo.options.trendlines[ memo.options.series.length - 1 ] = { type: 'linear', title: i18n.trendline, lineWidth: 0, color: 'transparent', visibleInLegend: false, tooltip: false };
| |
| }
| |
| | |
| } else if ( memo.seriesA[ s ].type == 'candlestick' ) {
| |
| | |
| memo.data.addColumn( 'date', memo.seriesA[ s ].title );
| |
| memo.data.addColumn( 'date', '' );
| |
| memo.data.addColumn( 'date', '' );
| |
| memo.data.addColumn( 'date', '' );
| |
| memo.data.addColumn({ role: 'tooltip', 'p': { 'html': true } });
| |
| | |
| memo.options.series.push( { type: 'candlesticks', color: memo.seriesA[ s ].color, strokeWidth: 2, stroke: '#cccccc' } );
| |
| | |
| }
| |
| | |
| }
| |
|
| |
|
| |
|
| // create data cols for each series | | // create data cols for each series |