Ero sivun ”Widget:Ice break-up graph” versioiden välillä
Järvi-meriwikistä
p (Tekstin korvaus – ”google.setOnLoadCallback(” muotoon ”google.charts.setOnLoadCallback(”) |
|||
(9 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 8: | Rivi 8: | ||
var lang = '<!--{$lang|default:fi|escape:'html'}-->'; | var lang = '<!--{$lang|default:fi|escape:'html'}-->'; | ||
var SiteID = '<!--{$SiteID|default:x|escape:'html'}-->'; | var SiteID = '<!--{$SiteID|default:x|escape:'html'}-->'; | ||
− | |||
− | |||
− | |||
− | + | function <!--{$id|default:drawIceBreakUpChart|escape:'html'}-->_jQueryTest() { | |
+ | if ( typeof window.jQuery == 'undefined' ) { | ||
+ | setTimeout( function(){ <!--{$id|default:drawIceBreakUpChart|escape:'html'}-->_jQueryTest() }, 300); | ||
+ | } else { | ||
+ | google.charts.load( 'current', { 'packages':[ 'corechart' ], 'language': 'fi' } ); | ||
+ | google.charts.setOnLoadCallback(<!--{$id|default:drawIceBreakUpChart|escape:'html'}-->_func); | ||
+ | } | ||
+ | } | ||
+ | setTimeout( function(){ <!--{$id|default:drawIceBreakUpChart|escape:'html'}-->_jQueryTest() }, 300); | ||
+ | function <!--{$id|default:drawIceBreakUpChart|escape:'html'}-->_func() { | ||
var searchStr = "action=ask&query="; | var searchStr = "action=ask&query="; | ||
searchStr += "[[Havainto::>0]][[SiteID::" + SiteID + "]]"; | searchStr += "[[Havainto::>0]][[SiteID::" + SiteID + "]]"; | ||
Rivi 50: | Rivi 56: | ||
for (var i in request.query.results) { | for (var i in request.query.results) { | ||
zi++; | zi++; | ||
− | resultItem = request.query.results[i].printouts; | + | resultItem = request.query.results[i].printouts; |
− | obsDate = new Date(toDateFromSecsSince1970(resultItem.Päivämäärä[0])); | + | |
+ | obsDate = new Date(toDateFromSecsSince1970(resultItem.Päivämäärä[0].timestamp)); | ||
if (obsDate.getFullYear() < firstYear) { firstYear = obsDate.getFullYear(); } | if (obsDate.getFullYear() < firstYear) { firstYear = obsDate.getFullYear(); } | ||
if (obsDate.getFullYear() > lastYear) { lastYear = obsDate.getFullYear(); } | if (obsDate.getFullYear() > lastYear) { lastYear = obsDate.getFullYear(); } | ||
Rivi 99: | Rivi 106: | ||
//else { freeText = ''; } | //else { freeText = ''; } | ||
− | obsDate = new Date(toDateFromSecsSince1970(resultItem.Päivämäärä[0])); | + | obsDate = new Date(toDateFromSecsSince1970(resultItem.Päivämäärä[0].timestamp)); |
sigma1 += (obsDate.getFullYear() - yearMean) * (obsDate.getDayOfYear() - daysMean); | sigma1 += (obsDate.getFullYear() - yearMean) * (obsDate.getDayOfYear() - daysMean); | ||
Rivi 118: | Rivi 125: | ||
zi++; | zi++; | ||
resultItem = request.query.results[i].printouts; | resultItem = request.query.results[i].printouts; | ||
− | obsDate = new Date(toDateFromSecsSince1970(resultItem.Päivämäärä[0])); | + | obsDate = new Date(toDateFromSecsSince1970(resultItem.Päivämäärä[0].timestamp)); |
dataRow = new Array(); | dataRow = new Array(); | ||
dataRow[0] = obsDate.getFullYear(); | dataRow[0] = obsDate.getFullYear(); | ||
dataRow[1] = obsDate.getDayOfYear(); | dataRow[1] = obsDate.getDayOfYear(); | ||
− | dataRow[2] = '<div style="padding: 8px;">' + obsDate.inRelationToToday(); | + | dataRow[2] = '<div style="padding: 8px; white-space: nowrap;">' + obsDate.inRelationToToday() + '</div>'; |
if (imagesArr[zi]) { | if (imagesArr[zi]) { | ||
dataRow[2] += '<br />' + '<div class="ibuTooltipDiv" id="ibuTooltipDiv_' + i + '" style="width: 144px; height: 144px;"><img class="ibuTooltipImg" id="ibuTooltipImg_' + i + '" style="max-width: 144px; max-height: 144px;" src="' + imagesArr[zi] + '" /></div>'; | dataRow[2] += '<br />' + '<div class="ibuTooltipDiv" id="ibuTooltipDiv_' + i + '" style="width: 144px; height: 144px;"><img class="ibuTooltipImg" id="ibuTooltipImg_' + i + '" style="max-width: 144px; max-height: 144px;" src="' + imagesArr[zi] + '" /></div>'; |