Ero sivun ”Widget:JwObsCharts2” versioiden välillä
Järvi-meriwikistä
Rivi 1 091: | Rivi 1 091: | ||
// 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' }; | ||
− | |||
− | |||
for (var o in memo.obsesA) { | for (var o in memo.obsesA) { | ||
− | if ( memo.obsesA[o].printouts.ObsCode == memo.refcode ) { | + | if ( memo.obsesA[o].printouts.ObsCode == memo.refcode ) { |
− | + | memo.obsesA[o].compareDate = getDateOfISOWeek( memo.obsesA[o].data.week, memo.curSeason ) | |
− | + | memo.obsesA[o].compareDate.setDate( memo.obsesA[o].compareDate.getDate() + 3 ); | |
− | |||
− | |||
− | memo.obsesA[o].compareDate | ||
} | } | ||
} | } | ||
+ | var weekdata = []; | ||
+ | for ( var w=1; w<=53; w++ ) { | ||
+ | weekdata.push( { 'week': w, 'val': null, 'mw': null, 'low': null, 'high': null } ); | ||
+ | } | ||
− | for (var o in memo.obsesA) { | + | for (var o in memo.obsesA) { |
+ | if ( memo.obsesA[ o ].printouts.ObsCode == memo.obscode ) { | ||
+ | weekdata[ memo.obsesA[ o ].val.week-1 ].val = memo.obsesA[ o ].data.val; | ||
+ | } else { | ||
+ | weekdata[ memo.obsesA[ o ].val.week-1 ].mw = memo.obsesA[ o ].data.val; | ||
+ | weekdata[ memo.obsesA[ o ].val.week-1 ].low = memo.obsesA[ o ].data.low; | ||
+ | weekdata[ memo.obsesA[ o ].val.week-1 ].high = memo.obsesA[ o ].data.high; | ||
+ | } | ||
+ | } | ||
− | console.log( memo.obsesA[o] ); | + | for ( var w in weekdata ) { |
+ | |||
+ | //console.log( memo.obsesA[o] ); | ||
//dateStr = memo.obsesA[o].popup.match( /\([^)]*\)/g ); | //dateStr = memo.obsesA[o].popup.match( /\([^)]*\)/g ); | ||
//yearStr = dateStr[0].match( /[0-9]{4}/g ); | //yearStr = dateStr[0].match( /[0-9]{4}/g ); | ||
− | memo.obsesA[o].popup = 'popup'; //memo.obsesA[o].popup.replace( dateStr[0], '(' + yearStr[0] + ')' ); | + | //memo.obsesA[o].popup = 'popup'; //memo.obsesA[o].popup.replace( dateStr[0], '(' + yearStr[0] + ')' ); |
+ | |||
+ | mow = getDateOfISOWeek( memo.obsesA[o].data.week, memo.curSeason ); | ||
+ | mow.setDate( memo.obsesA[o].compareDate.getDate() + 3 ); | ||
+ | |||
memo.dataA.push( [ | memo.dataA.push( [ | ||
− | + | mow, | |
− | + | weekdata[w].val, | |
− | + | weekdata[w].val.low/100, | |
− | + | weekdata[w].val.high/100, | |
− | + | null, | |
null, | null, | ||
− | + | null | |
] ); | ] ); | ||
} | } |