From ebc886064b09d081297192301ceeb9861fe7212f Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 26 Mar 2015 22:57:24 +1100 Subject: [PATCH] php - make the graph handle smaller screens better --- pool/page.php | 12 +++++++----- pool/page_usperf.php | 7 ++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pool/page.php b/pool/page.php index adecb75f..93332a94 100644 --- a/pool/page.php +++ b/pool/page.php @@ -80,11 +80,11 @@ gfz(c,gx0(c),0.55,wi,0,yt,'#0080ff','left'); var m=Math.round(0.5+xn/20.0); var f=1; for(var i=0;i=x0;i-=hrs){var n=dfmt(c,i);var xo=(i-x0)/(x1-x0);if(c['tkey']&&((l%hlv)==0)){gbe(c,xo,0);gln(c,xo,-0.02);gst(c);gfz(c,xo,0,0,-hi*tpos,n,'brown','center')}if(c['tlines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}l++}} +for(var i=xhr;i>=x0;i-=hrs){var n=dfmt(c,i);var xo=(i-x0)/(x1-x0);if(xo<=1&&c['tkey']&&((l%hlv)==0)){gbe(c,xo,0);gln(c,xo,-0.02);gst(c);gfz(c,xo,0,0,-hi*tpos,n,'brown','center')}if(xo<=1&&c['tlines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}l++}} glw(c,1); gss(c,'#0000c0'); if(c['smooth']){var xa=0,ya=0,xb=0,yb=0; @@ -98,10 +98,11 @@ var t=''+av.toFixed(2)+'av';gfz(c,1,y,1,0,t,'red','left') if(c['tkey']){var col,hrl=c['hrs'].length;for(var i=0;ic['xm']){c['ym']=c['xm']}c['xo']=0.0;c['yo']=0.0;c['ctx']=c['can'].getContext('2d');c['ctx'].canvas.width=c['xm']+1;c['ctx'].canvas.height=c['ym']+1;div.appendChild(c['can']);c['pxe']=Math.max(Math.round(c['xm']/250),1)} +function gc(c){var div=document.getElementById('can0');while(div.firstChild){div.removeChild(div.firstChild)}c['can']=document.createElement('canvas');c['can'].id='can';c['wx']=window.innerWidth;c['wy']=window.innerHeight;c['xm']=Math.max(Math.round(c['wx']*0.9+0.5),400);c['ym']=Math.max(Math.round(c['wy']*0.8+0.5),400);if(c['ym']>c['xm']){c['ym']=c['xm']}c['xo']=0.0;c['yo']=0.0;c['ctx']=c['can'].getContext('2d');c['ctx'].canvas.width=c['xm']+1;c['ctx'].canvas.height=c['ym']+1;div.appendChild(c['can']);c['pxe']=Math.max(Math.round(c['xm']/250),1)} function opts(t,i){var e=document.getElementById(i);if(t.checked){e.style.visibility='visible'}else{e.style.visibility='hidden'}} -function ghrs(c){c['hrs']=[1,2,3,4,6,8,12,24];c['hln']=[1,2,3,4,6]} -function gopt(c,cbx){for(var i=0;i=0;j--){if(tl $txt) - $pg .= " $txt "; + { + $pg .= ' '; + $pg .= ""; + $pg .= "$txt "; + } $pg .= ''; $pg .= '
';