Your IP : 3.12.148.140


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/main/amcharts/3.3/exporting/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/main/amcharts/3.3/exporting/amexport.min.js

AmCharts.AmExport=AmCharts.Class({construct:function(e,t){var a=this;a.DEBUG=false;a.chart=e;a.canvas=null;a.svgs=[];a.cfg={menuTop:"auto",menuLeft:"auto",menuRight:"0px",menuBottom:"0px",menuItems:[{textAlign:"center",icon:a.chart.pathToImages+"export.png",iconTitle:"Save chart as an image",format:"png"}],menuItemStyle:{backgroundColor:"transparent",rollOverBackgroundColor:"#EFEFEF",color:"#000000",rollOverColor:"#CC0000",paddingTop:"6px",paddingRight:"6px",paddingBottom:"6px",paddingLeft:"6px",marginTop:"0px",marginRight:"0px",marginBottom:"0px",marginLeft:"0px",textAlign:"left",textDecoration:"none",fontFamily:a.chart.fontFamily,fontSize:a.chart.fontSize+"px"},menuItemOutput:{backgroundColor:"#FFFFFF",fileName:"amChart",format:"png",output:"dataurlnewwindow",render:"browser",dpi:90,onclick:function(e,t,a){e.output(t)}},removeImagery:true};a.processing={buffer:[],drawn:0,timer:0};if(typeof window.canvg!="undefined"&&typeof window.RGBColor!="undefined"){a.cfg.menuItemOutput.render="canvg"}if(typeof window.saveAs!="undefined"){a.cfg.menuItemOutput.output="save"}if(AmCharts.isIE&&AmCharts.IEversion<10){a.cfg.menuItemOutput.output="dataurlnewwindow"}if(t){t.menuItemOutput=AmCharts.extend(a.cfg.menuItemOutput,t.menuItemOutput||{});t.menuItemStyle=AmCharts.extend(a.cfg.menuItemStyle,t.menuItemStyle||{});a.cfg=AmCharts.extend(a.cfg,t)}a.chart.AmExport=a;a.chart.addListener("rendered",function(){a.setup()});if(a.DEBUG){window.AmExport=a}},log:function(){console.log("AmExport: ",arguments)},setup:function(){var e=this;if(e.DEBUG==10){e.log("SETUP START")}if(!AmCharts.isIE||AmCharts.isIE&&AmCharts.IEversion>9){window.clearTimeout(e.processing.timer);e.processing.timer=setTimeout(function(){e.polifySVG();e.generateButtons();if(e.DEBUG==10){e.log("SETUP END")}},1e3)}else{if(e.DEBUG==10){e.log("< IE10 NOT SUPPORTED")}}},generateBinaryArray:function(e){var t=e.length,a=new Uint8Array(t/4*3|0),r=0,i=0,n=[0,0],o=0,s=0,u,l,g,f=new Uint8Array([62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]);while(t--){l=e.charCodeAt(r++);u=f[l-43];if(u!==255&&u!==g){n[1]=n[0];n[0]=l;s=s<<6|u;o++;if(o===4){a[i++]=s>>>16;if(n[1]!==61){a[i++]=s>>>8}if(n[0]!==61){a[i++]=s}o=0}}}return a},generateBlob:function(e,t){var a=this,r=e.indexOf(",")+1,i=e.substring(0,r),n=e,o=new Blob;if(i.indexOf("base64")!=-1){n=a.generateBinaryArray(e.substring(r))}if(AmCharts.isIE&&AmCharts.IEversion<10){o.data=n;o.size=n.length;o.type=t;o.encoding="base64"}else{o=new Blob([n],{type:t})}return o},generatePDF:function(e){var t=this,a={output:function(){return""}},r=t.canvas.toDataURL("image/jpeg"),i=t.canvas.width*25.4/e.dpi,n=t.canvas.height*25.4/e.dpi;if(window.jsPDF){a=new jsPDF;if(a.addImage){a.addImage(r,"JPEG",0,0,i,n)}else{alert("Missing jsPDF plugin; Please add the 'addImage' plugin.")}}else{alert("Missing jsPDF lib; Don't forget to add the addImage plugin.")}return a},output:function(e,t){var a=this;e=AmCharts.extend(AmCharts.extend({},a.cfg.menuItemOutput),e||{});function r(){var r=null;var i;if(a.DEBUG==10){a.log("OUTPUT",format)}if(e.format=="image/svg+xml"||e.format=="svg"){for(var n=0;n<a.processing.buffer.length;n++){r=(new XMLSerializer).serializeToString(a.processing.buffer[n][0]);i=a.generateBlob(r,"image/svg+xml");if(e.output=="save"){saveAs(i,e.fileName+".svg")}else if(e.output=="datastring"||e.output=="datauristring"||e.output=="dataurlstring"){i="data:image/svg+xml;base64,"+btoa(r)}else if(e.output=="dataurlnewwindow"){window.open("data:image/svg+xml;base64,"+btoa(r))}else if(e.output=="datauri"||e.output=="dataurl"){location.href="data:image/svg+xml;base64,"+btoa(r)}else if(e.output=="datastream"){location.href="data:image/octet-stream;base64,"+btoa(r)}if(t)t.apply(a,[i])}}else if(e.format=="application/pdf"||e.format=="pdf"){r=a.generatePDF(e).output("dataurlstring");i=a.generateBlob(r,"application/pdf");if(e.output=="save"){saveAs(i,e.fileName+".pdf")}else if(e.output=="datastring"||e.output=="datauristring"||e.output=="dataurlstring"){i=r}else if(e.output=="dataurlnewwindow"){window.open(r)}else if(e.output=="datauri"||e.output=="dataurl"){location.href=r}else if(e.output=="datastream"){location.href=r.replace("application/pdf","application/octet-stream")}if(t)t.apply(a,[i])}else if(e.format=="image/png"||e.format=="png"){r=a.canvas.toDataURL("image/png");i=a.generateBlob(r,"image/png");if(e.output=="save"){saveAs(i,e.fileName+".png")}else if(e.output=="datastring"||e.output=="datauristring"||e.output=="dataurlstring"){i=r}else if(e.output=="dataurlnewwindow"){window.open(r)}else if(e.output=="datauri"||e.output=="dataurl"){location.href=r}else if(e.output=="datastream"){location.href=r.replace("image/png","image/octet-stream")}if(t)t.apply(a,[i])}else if(e.format=="image/jpeg"||e.format=="jpeg"||e.format=="jpg"){r=a.canvas.toDataURL("image/jpeg");i=a.generateBlob(r,"image/jpeg");if(e.output=="save"){saveAs(i,e.fileName+".jpg")}else if(e.output=="datastring"||e.output=="datauristring"||e.output=="dataurlstring"){i=r}else if(e.output=="dataurlnewwindow"){window.open(r)}else if(e.output=="datauri"||e.output=="dataurl"){location.href=r}else if(e.output=="datastream"){location.href=r.replace("image/jpeg","image/octet-stream")}if(t)t.apply(a,[i])}}return a.generateOutput(e,r)},polifySVG:function(){var e=this;var t=e.chart.div.getElementsByTagName("svg");function a(t,a){var r=t.getElementsByTagName(a);for(var i=0;i<r.length;i++){if(e.cfg.removeImagery){r[i].parentNode.removeChild(r[i])}else{var n=document.createElement("img");var o=document.createElement("canvas");var s=o.getContext("2d");o.width=r[i].getAttribute("width");o.height=r[i].getAttribute("height");n.src=r[i].getAttribute("xlink:href");n.width=r[i].getAttribute("width");n.height=r[i].getAttribute("height");try{s.drawImage(n,0,0,n.width,n.height);datastring=o.toDataURL()}catch(u){datastring=n.src;e.log("Tainted canvas, reached browser CORS security; origin from imagery must be equal to the server!");throw new Error(u)}r[i].setAttribute("xlink:href",datastring)}if(e.DEBUG==10){e.log("POLIFIED",r[i])}}}for(var r=0;r<t.length;r++){var i=t[r].parentNode;if(e.DEBUG==10){e.log("POLIFIED",t[r])}a(t[r],"pattern");a(t[r],"image");e.svgs.push(t[r])}return t},generateOutput:function(e,t){var a=this,r=a.chart.div.getElementsByTagName("svg"),i=document.createElement("canvas"),n=i.getContext("2d"),o={y:0,x:0},s={};a.processing.buffer=[];a.processing.drawn=0;a.canvas=i;if(a.DEBUG==10){a.log("START EXPORT")}if(a.DEBUG==10){a.log("START BUFFERING")}for(var u=0;u<r.length;u++){var l=r[u].parentNode,g=Number(l.style.left.slice(0,-2)),f=Number(l.style.top.slice(0,-2));s=AmCharts.extend({},o);o.x=g?g:o.x;o.y=f?f:o.y;a.processing.buffer.push([r[u],AmCharts.extend({},o)]);if(f&&g){o=s}else{o.y+=f?0:l.offsetHeight}if(a.DEBUG==10){a.log("BUFFERED",r[u],o)}}if(a.DEBUG==10){a.log("END BUFFERING")}if(a.DEBUG==10){a.log("START DRAWING",e.render)}if(a.DEBUG==10){a.log("FILL BACKGROUND")}i.id=AmCharts.getUniqueId();i.width=a.chart.divRealWidth;i.height=a.chart.divRealHeight;if(e.backgroundColor||format=="image/jpeg"){n.fillStyle=e.backgroundColor||"#FFFFFF";n.fillRect(0,0,i.width,i.height)}function d(){var r,o,s,u;if(a.processing.buffer.length==a.processing.drawn){if(a.DEBUG==10){a.log("END DRAWING")}return t()}else{if(a.DEBUG==10){a.log("DRAW",a.processing.drawn+1,"OF",a.processing.buffer.length)}o=a.processing.buffer[a.processing.drawn];u=(new XMLSerializer).serializeToString(o[0]);s=o[1];if(a.DEBUG==10){a.log("SOURCE",u)}if(e.render=="browser"){r=new Image;r.id=AmCharts.getUniqueId();u="data:image/svg+xml;base64,"+btoa(u);r.onload=function(){n.drawImage(this,o[1].x,o[1].y);a.processing.drawn++;if(a.DEBUG==10){a.log("ONLOAD",this)}d()};r.onerror=function(){if(a.DEBUG==10){a.log("ONERROR",this)}n.drawImage(this,o[1].x,o[1].y);a.processing.drawn++;d()};r.src=u;if(a.DEBUG==10){a.log("ADD",r)}if(r.complete||typeof r.complete=="undefined"||r.complete===undefined){if(a.DEBUG==10){a.log("FORCE ONLOAD",r)}r.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";r.src=u}}else if(e.render=="canvg"){canvg(i,u,{offsetX:s.x,offsetY:s.y,ignoreMouse:true,ignoreAnimation:true,ignoreDimensions:true,ignoreClear:true,renderCallback:function(){a.processing.drawn++;d()}})}}}return d()},generateButtons:function(){var e=this,t=document.createElement("div"),a=0;function r(t){var i=document.createElement("ul");i.setAttribute("style","list-style: none; margin: 0; padding: 0;");for(var n=0;n<t.length;n++){var o=document.createElement("li"),s=document.createElement("img"),u=document.createElement("a"),l=t[n],g=null,f=AmCharts.extend(AmCharts.extend({},e.cfg.menuItemStyle),t[n]);l=AmCharts.extend(AmCharts.extend({},e.cfg.menuItemOutput),l);if(l["icon"]){s.alt="";s.src=l["icon"];s.setAttribute("style","margin: 0 auto;border: none;outline: none");if(l["iconTitle"]){s.title=l["iconTitle"]}u.appendChild(s)}u.href="#";if(l["title"]){s.setAttribute("style","margin-right: 5px;");u.innerHTML+=l.title}u.setAttribute("style","display: block;");AmCharts.extend(u.style,f);u.onclick=l.onclick.bind(u,e,l);o.appendChild(u);if(l.items){g=r(l.items);o.appendChild(g);o.onmouseover=function(){g.style.display="block"};o.onmouseout=function(){g.style.display="none"};g.style.display="none"}i.appendChild(o);u.onmouseover=function(){this.style.backgroundColor=f.rollOverBackgroundColor;this.style.color=f.rollOverColor;this.style.borderColor=f.rollOverBorderColor};u.onmouseout=function(){this.style.backgroundColor=f.backgroundColor;this.style.color=f.color;this.style.borderColor=f.borderColor}}a++;if(e.DEBUG==10){e.log("MENU",i)}return i}t.setAttribute("style","position: absolute;top:"+e.cfg.menuTop+";right:"+e.cfg.menuRight+";bottom:"+e.cfg.menuBottom+";left:"+e.cfg.menuLeft+";box-shadow:0px 0px 1px 0px rgba(0,0,0,0);");t.appendChild(r(e.cfg.menuItems));e.chart.containerDiv.appendChild(t)}});
//# sourceMappingURL=amexport.map.js