Ero sivun ”Widget:JwObsCharts” versioiden välillä
Järvi-meriwikistä
Rivi 750: | Rivi 750: | ||
ac++; | ac++; | ||
} | } | ||
+ | |||
+ | var asvg = '<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">'; | ||
+ | asvg += '<style type="text/css">.alg0{fill:#0076B0;} .alg1{fill:#D5DA26;} .algx{fill:#ccc;}</style>'; | ||
+ | |||
+ | var rx = 10; | ||
+ | var ry = 10; | ||
+ | |||
+ | for ( var rc = 0; rc++; rc<10 ) { | ||
+ | for ( var cc = 0; cc++; cc<10 ) { | ||
+ | x = cc * 10; | ||
+ | y = rc * 10; | ||
+ | asvg += '<rect x="' + x.toString() +'" y="' + x.toString() +'" class="alg0" width="8" height="8"/>' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | asvg += '</svg>'; | ||
if ( ac > 0 ) { | if ( ac > 0 ) { | ||
var aavg = Math.round( asum/ac ); | var aavg = Math.round( asum/ac ); | ||
− | if ( aavg < 0.5 ) { | + | if ( aavg < 0.5 ) { astr = 'Ei sinilevää'; } |
− | + | else if ( aavg < 1.5 ) { astr = 'Hieman sinilevää'; } | |
− | + | else if ( aavg < 2.5 ) { astr = 'Runsaasti sinilevää'; } | |
− | + | else { astr = 'Erittäin runsaasti sinilevää'; } | |
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
astr = 'Ei tuoreita havaintoja'; | astr = 'Ei tuoreita havaintoja'; | ||
Rivi 767: | Rivi 778: | ||
memo.widgetEl.html(''); | memo.widgetEl.html(''); | ||
memo.widgetEl.append( '<h3 style="text-align: center; font-size: 100%; margin-top: 0;">Sinilevätilanne</h3>' ); | memo.widgetEl.append( '<h3 style="text-align: center; font-size: 100%; margin-top: 0;">Sinilevätilanne</h3>' ); | ||
− | memo.widgetEl.append( '<div style="width: 120px; height: 120px; margin: 10px auto; padding: 10px; border-radius: 6px; Xborder: 3px solid rgba( 213, 218, 38, 0.5 );"> | + | memo.widgetEl.append( '<div style="width: 120px; height: 120px; margin: 10px auto; padding: 10px; border-radius: 6px; Xborder: 3px solid rgba( 213, 218, 38, 0.5 );">' + asvg + '</div>'); |
memo.widgetEl.append( '<p style="text-align: center; Xline-height: 20px;" class="huomio">' + astr + '</p>' ); | memo.widgetEl.append( '<p style="text-align: center; Xline-height: 20px;" class="huomio">' + astr + '</p>' ); | ||
} | } |