wahs-the-weather/lib/steelseries/scripts/RGraph.common.core.min.js

1 line
36 KiB
JavaScript
Raw Normal View History

2024-12-11 21:20:28 +00:00
function pd(n){RGraph.pr(n)}function p(n){RGraph.pr(n)}function a(n){alert(n)}function cl(n){return console.log(n)}typeof RGraph=="undefined"&&(RGraph={isRGraph:!0,type:"common"}),RGraph.Registry={},RGraph.Registry.store=[],RGraph.Registry.store["chart.event.handlers"]=[],RGraph.Registry.store.__rgraph_event_listeners__=[],RGraph.background={},RGraph.objects=[],RGraph.Resizing={},RGraph.events=[],RGraph.cursor=[],RGraph.DOM2Events={},RGraph.ObjectRegistry={},RGraph.ObjectRegistry.objects={},RGraph.ObjectRegistry.objects.byUID=[],RGraph.ObjectRegistry.objects.byCanvasID=[],HALFPI=Math.PI/2,PI=Math.PI,TWOPI=PI*2,ISOPERA=navigator.userAgent.indexOf("Opera")!=-1,RGraph.getScale=function(n,t){var f,e,i,o,u,r;if(n==0)return["0.2","0.4","0.6","0.8","1.0"];if(f=n,n<=1){if(n>.5)return[.2,.4,.6,.8,Number(1).toFixed(1)];if(n>=.1)return t.Get("chart.scale.round")?[.2,.4,.6,.8,1]:[.1,.2,.3,.4,.5];for(e=n,i=0;e<1.01;)i+=1,e*=10;return o=["2e-"+i,"4e-"+i,"6e-"+i,"8e-"+i,"10e-"+i],n<="5e-"+i&&(o=["1e-"+i,"2e-"+i,"3e-"+i,"4e-"+i,"5e-"+i]),o}for(String(n).indexOf(".")>0&&(n=String(n).replace(/\.\d+$/,"")),u=Math.pow(10,Number(String(Number(n)).length-1)),r=u;r<n;)r+=u/2;return Number(f)>Number(r)&&(r+=u/2),n<10&&(r=Number(f)<=5?5:10),t&&typeof t.Get("chart.scale.round")=="boolean"&&t.Get("chart.scale.round")&&(r=10*u),[r*.2,r*.4,r*.6,r*.8,r]},RGraph.array_max=function(n){var i=null,t,r;if(typeof n=="number")return n;for(t=0;t<n.length;++t)typeof n[t]=="number"&&(r=arguments[1]?Math.abs(n[t]):n[t],i=typeof i=="number"?Math.max(i,r):r);return i},RGraph.array_pad=function(n,t){var r,i;if(n.length<t)for(r=arguments[2]?arguments[2]:null,i=n.length;i<t;++i)n[i]=r;return n},RGraph.array_sum=function(n){if(typeof n=="number")return n;for(var r=n.length,t=0,i=0;t<r;i+=n[t++]);return i},RGraph.array_linearize=function(){for(var r=[],t,u,i,n=0;n<arguments.length;++n)if(typeof arguments[n]=="object"&&arguments[n])for(t=0;t<arguments[n].length;++t)for(u=RGraph.array_linearize(arguments[n][t]),i=0;i<u.length;++i)r.push(u[i]);else r.push(arguments[n]);return r},RGraph.Text=function(n,t,i,r,u,f){var e=arguments,v,c,l,a,o,s;if((typeof f=="string"||typeof f=="number")&&f!="undefined"){if(typeof f=="string"&&f.match(/\r\n/)){for(v=RGraph.MeasureText("M",e[11],t,i),c=f.split("\r\n"),e[6]&&e[6]=="center"&&(u=u-v[1]*((c.length-1)/2)),l=1;l<c.length;++l)RGraph.Text(n,t,i,e[9]==-90?r+i*1.5:r,u+v[1]*l,c[l],e[6]?e[6]:null,e[7],e[8],e[9],e[10],e[11],e[12]);f=c[0]}document.all&&ISOLD&&(u+=2),n.font=(e[11]?"Bold ":"")+i+"pt "+t;var l,d=r,g=u,y=n.fillStyle,k=n.lineWidth;if(typeof e[6]=="undefined"&&(e[6]="bottom"),typeof e[7]=="undefined"&&(e[7]="left"),typeof e[8]=="undefined"&&(e[8]=null),typeof e[9]=="undefined"&&(e[9]=0),navigator.userAgent.indexOf("Opera")!=-1&&(n.canvas.__rgraph_valign__=e[6],n.canvas.__rgraph_halign__=e[7]),n.save(),n.canvas.__rgraph_originalx__=r,n.canvas.__rgraph_originaly__=u,n.translate(r,u),r=0,u=0,e[9]&&n.rotate(e[9]/(180/PI)),e[6]&&(a=e[6],a=="center"?n.textBaseline="middle":a=="top"&&(n.textBaseline="top")),e[7]&&(o=e[7],s=n.measureText(f).width,o&&(o=="center"?n.textAlign="center":o=="right"&&(n.textAlign="right"))),n.fillStyle=y,n.save(),n.fillText(f,0,0),n.lineWidth=1,e[8]){var s=n.measureText(f).width,p=o=="center"?s/2:o=="right"?s:0,h=i*1.4,w=a=="center"?h/2:a=="top"?h:0,b=ISOLD?2:0;n.strokeRect(-3-p,-3-h-b+w,s+6,h+6),e[10]&&(n.fillStyle=e[10],n.fillRect(-3-p,-3-h-b+w,s+6,h+6)),n.fillStyle=y,n.fillText(f,0,0)}n.restore(),n.lineWidth=k,n.restore()}},RGraph.Clear=function(n){var t,i,r;n&&(RGraph.FireCustomEvent(n.__object__,"onbeforeclear"),t=n.getContext("2d"),i=arguments[1],ISIE8&&!i&&(i="white"),!i||i&&i=="rgba(0,0,0,0)"||i=="transparent"?(t.clearRect(0,0,n.width,n.height),t.globalCompositeOperation="source-over"):(t.fillStyle=i,t=n.getContext("2d"),t.beginPath(),ISIE8?t.fillRect(0,0,n.width,n.height):t.fillRect(-10,-10,n.width+20,n.height+20),t.fill()),RGraph.ClearAnnotations,RGraph.Registry.Get("chart.background.image."+n.id)&&(r=RGraph.Registry.Get("chart.background.image."+n.id),r.style.position="absolute",r.style.left="-1