Ero sivun ”Widget:JwCurrentCharts” versioiden välillä
Järvi-meriwikistä
Rivi 573: | Rivi 573: | ||
} else if ( memo.obscode == 'ice' ) { | } else if ( memo.obscode == 'ice' ) { | ||
+ | |||
+ | var isum = 0; | ||
+ | var itsum = 0; | ||
+ | var ic = 0; | ||
+ | var icsum = 0; | ||
+ | |||
+ | for ( var o in memo.obsesA ) { | ||
+ | iw = ( 7 - Math.round( ( today.getTime() - memo.obsesA[o].obsdatetime.getTime() ) / ( 24*60*60*1000 ) ) ); | ||
+ | isum += parseInt( memo.obsesA[o].data.cat ) * iw; | ||
+ | //itsum += memo.obsesA[o].data.val * iw; | ||
+ | icsum = icsum + iw; | ||
+ | ic++; | ||
+ | } | ||
+ | |||
+ | if ( ic > 0 ) { | ||
+ | iavg = Math.round( isum/icsum ); | ||
+ | //istr = iavg.toString().replace( '.', ',' ) + ' °C'; | ||
+ | if ( ic == 1 ) { | ||
+ | istr += '<br /><span>(' + memo.obsesA[0].obsdatetime.inRelationToToday(memo.lang).toLowerCase() + ')</span>'; | ||
+ | } else { | ||
+ | //tstr += '<br /><span>(' + tc.toString() + ' havaintoa)</span>'; | ||
+ | //tstr += ' <span class="smaller">(n=' + tc.toString() + ')</span><br /><span>(viimeisin ' + memo.obsesA[0].obsdatetime.inRelationToToday(memo.lang).toLowerCase() + ')</span>'; | ||
+ | istr += '<br /><span class="smaller">(n=' + tc.toString() + ', viimeisin ' + memo.obsesA[0].obsdatetime.inRelationToToday(memo.lang).toLowerCase() + ')</span>'; | ||
+ | } | ||
+ | up = Math.round( (iavg/33)*50 ); | ||
+ | up = Math.max( up, 0 ); | ||
+ | up = Math.min( up, 50 ); | ||
+ | |||
+ | a1 = 60 - up; | ||
+ | a2 = 9 + up; | ||
+ | } else { | ||
+ | iavg = -1; | ||
+ | istr = 'Ei tuoreita<br />havaintoja'; | ||
+ | a1 = 60 - 25; | ||
+ | a2 = 9 + 25; | ||
+ | } | ||
− | + | ||
− | + | iceT = 'XX'; //obs.value.toString() + ' cm'; | |
− | iceT =obs.value.toString() + ' cm'; | ||
memo.widgetEl.html(''); | memo.widgetEl.html(''); | ||
memo.widgetEl.append( '<p style="text-align: center; line-height: 20px;" class="huomio">' + obs.obsdatetime.inRelationToToday(memo.lang) + '</p>' ); | 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( '<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>' ); | ||