Commit 08a66a841843b8e1cc3cbe53718243890f9ce91c
1 parent
c4fcafbd
Exists in
master
and in
7 other branches
Inclusão da biblioteca formatnumber e CCC2 para geração de gráficos
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,9 @@ |
1 | +/* | |
2 | + IntegraXor Web SCADA - JavaScript Number Formatter | |
3 | + http://www.integraxor.com/ | |
4 | + author: KPL, KHL | |
5 | + (c)2011 ecava | |
6 | + Dual licensed under the MIT or GPL Version 2 licenses. | |
7 | +*/ | |
8 | +window.format=function(b,a){if(!b||isNaN(+a))return a;var a=b.charAt(0)=="-"?-a:+a,j=a<0?a=-a:0,e=b.match(/[^\d\-\+#]/g),h=e&&e[e.length-1]||".",e=e&&e[1]&&e[0]||",",b=b.split(h),a=a.toFixed(b[1]&&b[1].length),a=+a+"",d=b[1]&&b[1].lastIndexOf("0"),c=a.split(".");if(!c[1]||c[1]&&c[1].length<=d)a=(+a).toFixed(d+1);d=b[0].split(e);b[0]=d.join("");var f=b[0]&&b[0].indexOf("0");if(f>-1)for(;c[0].length<b[0].length-f;)c[0]="0"+c[0];else+c[0]==0&&(c[0]="");a=a.split(".");a[0]=c[0];if(c=d[1]&&d[d.length- | |
9 | +1].length){for(var d=a[0],f="",k=d.length%c,g=0,i=d.length;g<i;g++)f+=d.charAt(g),!((g-k+1)%c)&&g<i-c&&(f+=e);a[0]=f}a[1]=b[1]&&a[1]?h+a[1]:"";return(j?"-":"")+a[0]+a[1]}; | ... | ... |