1 line
116 KiB
JavaScript
1 line
116 KiB
JavaScript
|
function roundToWithThousands(e,t,n){var r=1*unFormat(e,t);if(typeof r=="number"&&n!="none"){if(n<=0){var i=-n;r=+(Math.round(r+"e+"+i)+"e-"+i)}else{var i=n;var s="1e+"+i;value=+Math.round(r/s)*s}}r=fmtChartJS(e,r,"none");return r}function unFormat(e,t){if((e.decimalSeparator!="."||e.thousandSeparator!="")&&typeof t=="string"){var n=""+t;if(e.thousandSeparator!=""){while(n.indexOf(e.thousandSeparator)>=0)n=""+n.replace(e.thousandSeparator,"")}if(e.decimalSeparator!=".")n=""+n.replace(e.decimalSeparator,".");return 1*n}else{return t}}function fmtChartJSPerso(e,t,n){switch(n){case"SampleJS_Format":if(typeof t=="number")return_value="My Format : "+t.toString()+" $";else return_value=t+"XX";break;case"Change_Month":if(typeof t=="string")return_value=t.toString()+" 2014";else return_value=t.toString()+"YY";break;default:return_value=t;break}return return_value}function fmtChartJS(e,t,n){var r;if(n=="notformatted"){r=t}else if(n=="none"&&typeof t=="number"){if(e.roundNumber!="none"){if(e.roundNumber<=0){var i=-e.roundNumber;t=+(Math.round(t+"e+"+i)+"e-"+i)}else{var i=e.roundNumber;var s="1e+"+i;t=+Math.round(t/s)*s}}if(e.decimalSeparator!="."||e.thousandSeparator!=""){r=t.toString().replace(/\./g,e.decimalSeparator);if(e.thousandSeparator!=""){var o=r;var u="";var a=o.indexOf(e.decimalSeparator);if(a>=0){u=o.substring(a+1,o.length);u=u.split("").reverse().join("");o=o.substring(0,a)}o=o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,e.thousandSeparator);u=u.split("").reverse().join("");r=o;if(u!="")r=r+e.decimalSeparator+u}}else r=t}else if(n!="none"&&n!="notformatted"){r=fmtChartJSPerso(e,t,n)}else{r=t}return r}function tmplbis(e,t){var n=!/\W/.test(e)?cachebis[e]=cachebis[e]||tmplbis(document.getElementById(e).innerHTML):new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};"+"with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return t?n(t):n}function createCursorDiv(){if(cursorDivCreated==false){var e=document.createElement("divCursor");e.id="divCursor";e.style.position="absolute";document.body.appendChild(e);cursorDivCreated=true}}function checkBrowser(){this.ver=navigator.appVersion;this.dom=document.getElementById?1:0;this.ie5=this.ver.indexOf("MSIE 5")>-1&&this.dom?1:0;this.ie4=document.all&&!this.dom?1:0;this.ns5=this.dom&&parseInt(this.ver)>=5?1:0;this.ns4=document.layers&&!this.dom?1:0;this.bw=this.ie5||this.ie4||this.ns4||this.ns5;return this}function cursorInit(){scrolled=bw.ns4||bw.ns5?"window.pageYOffset":"document.body.scrollTop";if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)}function makeCursorObj(obj,nest){createCursorDiv();nest=!nest?"":"document."+nest+".";this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers."+obj):0;this.moveIt=b_moveIt;cursorInit();return this}function b_moveIt(e,t){this.x=e;this.y=t;this.css.left=this.x+"px";this.css.top=this.y+"px"}function isIE(){var e=navigator.userAgent.toLowerCase();return e.indexOf("msie")!=-1?parseInt(e.split("msie")[1]):false}function mergeChartConfig(e,t){var n={};for(var r in e){n[r]=e[r]}for(var r in t){n[r]=t[r]}return n}function sleep(e){var t=new Date;t.setTime(t.getTime()+e);while((new Date).getTime()<t.getTime()){}}function saveCanvas(e,t,n,r){cvSave=e.getImageData(0,0,e.canvas.width,e.canvas.height);var i={savePng:false,annotateDisplay:false,animation:false,dynamicDisplay:false};var s=mergeChartConfig(n,i);s.clearRect=false;switch(r){case"Bar":(new Chart(e.canvas.getContext("2d"))).Bar(t,s);break;case"Pie":(new Chart(e.canvas.getContext("2d"))).Pie(t,s);break;case"Doughnut":(new Chart(e.canvas.getContext("2d"))).Doughnut(t,s);break;case"Radar":(new Chart(e.canvas.getContext("2d"))).Radar(t,s);break;case"PolarArea":(new Chart(e.canvas.getContext("2d"))).PolarArea(t,s);break;case"HorizontalBar":(new Chart(e.canvas.getContext("2d"))).HorizontalBar(t,s);break;case"StackedBar":(new Chart(e.canva
|