1
office
1
/*
2
Highcharts JS v5.0.10 (2017-03-31)
3
Exporting module
4
5
(c) 2010-2017 Torstein Honsi
6
7
License: www.highcharts.com/license
8
*/
9
(function (k){"object" ===typeof module&&module.exports?module.exports=k:k(Highcharts)})(function (k){(function (f){var k=f.defaultOptions,u=f.doc,A=f.Chart,x=f.addEvent,G=f.removeEvent,E=f.fireEvent,w=f.createElement,B=f.discardElement,F=f.css,v=f.merge,C=f.pick,t=f.each,y=f.extend,z=f.win,D=f.SVGRenderer,H=f.Renderer.prototype.symbols;y(k.lang,{printChart:"Print chart" ,downloadPNG:"Download PNG image" ,downloadJPEG:"Download JPEG image" ,downloadPDF:"Download PDF document" ,downloadSVG:"Download SVG vector image" ,
10
contextButtonTitle:"Chart context menu" });k.navigation={buttonOptions:{theme:{},symbolSize:14,symbolX:12.5,symbolY:10.5,align:"right" ,buttonSpacing:3,height:22,verticalAlign:"top" ,width:24}};k.exporting={type:"image/png" ,url:"https://export.highcharts.com/" ,printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton" ,menuClassName:"highcharts-contextmenu" ,symbol:"menu" ,_titleKey:"contextButtonTitle" ,menuItems:[{textKey:"printChart" ,onclick:function (){this .print()}},{separator:!0},
11
{textKey:"downloadPNG" ,onclick:function (){this .exportChart()}},{textKey:"downloadJPEG" ,onclick:function (){this .exportChart({type:"image/jpeg" })}},{textKey:"downloadPDF" ,onclick:function (){this .exportChart({type:"application/pdf" })}},{textKey:"downloadSVG" ,onclick:function (){this .exportChart({type:"image/svg+xml" })}}]}}};f.post=function (a,b,d){var c;a=w("form" ,v({method:"post" ,action:a,enctype:"multipart/form-data" },d),{display:"none" },u.body);for (c in b)w("input" ,{type:"hidden" ,name:c,value:b[c]},
12
null ,a);a.submit();B(a)};y(A.prototype,{sanitizeSVG:function (a,b){if (b&&b.exporting&&b.exporting.allowHTML){var d=a.match(/<\/svg>(.*?$)/ );d&&d[1]&&(d='\x3cforeignObject x\x3d"0" y\x3d"0" width\x3d"' +b.chart.width+'" height\x3d"' +b.chart.height+'"\x3e\x3cbody xmlns\x3d"http://www.w3.org/1999/xhtml"\x3e' +d[1]+"\x3c/body\x3e\x3c/foreignObject\x3e" ,a=a.replace("\x3c/svg\x3e" ,d+"\x3c/svg\x3e" ))}return a=a.replace(/zIndex="[^"]+"/ g,"" ).replace(/isShadow="[^"]+"/ g,"" ).replace(/symbolName="[^"]+"/ g,"" ).replace(/jQuery[0-9]+="[^"]+"/ g,\/svg>
13
<\/svg>"" ).replace(/url\(("|")(\S+)("|")\)/ g,"url($2)" ).replace(/url\([^#]+#/ g,"url(#" ).replace(/ ,'\x3csvg xmlns:xlink\x3d"http://www.w3.org/1999/xlink" ' ).replace(/ (NS[0-9]+\:)?href=/ g," xlink:href\x3d" ).replace(/\n/ ," " ).replace(/<\/svg>.*?$/ ,"\x3c/svg\x3e" ).replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/ g,'$1\x3d"rgb($2)" $1-opacity\x3d"$3"' ).replace(/ / g,"\u00a0" ).replace(// g,"\u00ad" )},getChartHTML:function (){this .inlineStyles();return this .container.innerHTML},\/svg>\/svg>
14
<\/svg><\/svg>getSVG:function (a){var b,d,c,q,l,g=v(this .options,a);u.createElementNS||(u.createElementNS=function (a,b){return u.createElement(b)});d=w("div" ,null ,{position:"absolute" ,top:"-9999em" ,width:this .chartWidth+"px" ,height:this .chartHeight+"px" },u.body);c=this .renderTo.style.width;l=this .renderTo.style.height;c=g.exporting.sourceWidth||g.chart.width||/px$/ .test(c)&&parseInt (c,10)||600;l=g.exporting.sourceHeight||g.chart.height||/px$/ .test(l)&&parseInt (l,10)||400;y(g.chart,{animation:!1,renderTo:d,forExport:!0,\/svg> \/svg>
15
<\/svg><\/svg>renderer:"SVGRenderer" ,width:c,height:l});g.exporting.enabled=!1;delete g.data;g.series=[];t(this .series,function (a){q=v(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});q.isInternal||g.series.push(q)});t(this .axes,function (a){a.userOptions.internalKey||(a.userOptions.internalKey=f.uniqueKey())});b=new f.Chart(g,this .callback);a&&t(["xAxis" ,"yAxis" ,"series" ],function (c){var e={};a[c]&&(e[c]=a[c],b.update(e))});t(this .axes,function (a){var c=f.find(b.axes,function (b){return b.options.internalKey===\/svg> \/svg>
16
<\/svg><\/svg>a.userOptions.internalKey}),e=a.getExtremes(),d=e.userMin,e=e.userMax;!c||void 0===d&&void 0===e||c.setExtremes(d,e,!0,!1)});c=b.getChartHTML();c=this .sanitizeSVG(c,g);g=null ;b.destroy();B(d);return c},getSVGForExport:function (a,b){var d=this .options.exporting;return this .getSVG(v({chart:{borderRadius:0}},d.chartOptions,b,{exporting:{sourceWidth:a&&a.sourceWidth||d.sourceWidth,sourceHeight:a&&a.sourceHeight||d.sourceHeight}}))},exportChart:function (a,b){b=this .getSVGForExport(a,b);a=v(this .options.exporting,\/svg> \/svg>
17
<\/svg><\/svg>a);f.post(a.url,{filename:a.filename||"chart" ,type:a.type,width:a.width||0,scale:a.scale,svg:b},a.formAttributes)},print:function (){var a=this ,b=a.container,d=[],c=b.parentNode,f=u.body,l=f.childNodes,g=a.options.exporting.printMaxWidth,e,p;if (!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null ,0);E(a,"beforePrint" );if (p=g&&a.chartWidth>g)e=[a.options.chart.width,void 0,!1],a.setSize(g,void 0,!1);t(l,function (a,b){1===a.nodeType&&(d[b]=a.style.display,a.style.display="none" )});f.appendChild(b);z.focus();\/svg> \/svg>
18
<\/svg><\/svg>z.print();setTimeout(function (){c.appendChild(b);t(l,function (a,b){1===a.nodeType&&(a.style.display=d[b])});a.isPrinting=!1;p&&a.setSize.apply(a,e);E(a,"afterPrint" )},1E3)}},contextMenu:function (a,b,d,c,f,l,g){var e=this ,p=e.chartWidth,h=e.chartHeight,n="cache-" +a,m=e[n],q=Math .max(f,l),r,k;m||(e[n]=m=w("div" ,{className:a},{position:"absolute" ,zIndex:1E3,padding:q+"px" },e.container),r=w("div" ,{className:"highcharts-menu" },null ,m),k=function (){F(m,{display:"none" });g&&g.setState(0);e.openMenu=!1},\/svg> \/svg>
19
<\/svg><\/svg>e.exportEvents.push(x(m,"mouseleave" ,function (){m.hideTimer=setTimeout(k,500)}),x(m,"mouseenter" ,function (){clearTimeout(m.hideTimer)}),x(u,"mouseup" ,function (b){e.pointer.inClass(b.target,a)||k()})),t(b,function (a){if (a){var b;b=a.separator?w("hr" ,null ,null ,r):w("div" ,{className:"highcharts-menu-item" ,onclick:function (b){b&&b.stopPropagation();k();a.onclick&&a.onclick.apply(e,arguments)},innerHTML:a.text||e.options.lang[a.textKey]},null ,r);e.exportDivElements.push(b)}}),e.exportDivElements.push(r,\/svg> \/svg>
20
<\/svg><\/svg>m),e.exportMenuWidth=m.offsetWidth,e.exportMenuHeight=m.offsetHeight);b={display:"block" };d+e.exportMenuWidth>p?b.right=p-d-f-q+"px" :b.left=d-q+"px" ;c+l+e.exportMenuHeight>h&&"top" !==g.alignOptions.verticalAlign?b.bottom=h-c-q+"px" :b.top=c+l-q+"px" ;F(m,b);e.openMenu=!0},addButton:function (a){var b=this ,d=b.renderer,c=v(b.options.navigation.buttonOptions,a),f=c.onclick,l=c.menuItems,g,e,p=c.symbolSize||12;b.btnCount||(b.btnCount=0);b.exportDivElements||(b.exportDivElements=[],b.exportSVGElements=[]);\/svg> \/svg>
21
<\/svg><\/svg>if (!1!==c.enabled){var h=c.theme,n=h.states,m=n&&n.hover,n=n&&n.select,k;delete h.states;f?k=function (a){a.stopPropagation();f.call(b,a)}:l&&(k=function (){b.contextMenu(e.menuClassName,l,e.translateX,e.translateY,e.width,e.height,e);e.setState(2)});c.text&&c.symbol?h.paddingLeft=C(h.paddingLeft,25):c.text||y(h,{width:c.width,height:c.height,padding:0});e=d.button(c.text,0,0,k,h,m,n).addClass(a.className).attr({title:b.options.lang[c._titleKey],zIndex:3});e.menuClassName=a.menuClassName||"highcharts-menu-" +\/svg> \/svg>
22
<\/svg><\/svg>b.btnCount++;c.symbol&&(g=d.symbol(c.symbol,c.symbolX-p/2,c.symbolY-p/ 2,p,p).addClass("highcharts-button-symbol" ).attr({zIndex:1}).add(e));e.add().align(y(c,{width:e.width,x:C(c.x,b.buttonOffset)}),!0,"spacingBox" );b.buttonOffset+=(e.width+c.buttonSpacing)*("right" ===c.align?-1:1);b.exportSVGElements.push(e,g)}},destroyExport:function (a){var b=a?a.target:this ;a=b.exportSVGElements;var d=b.exportDivElements,c=b.exportEvents,f;a&&(t(a,function (a,c){a&&(a.onclick=a.ontouchstart=null ,f="cache-" +a.menuClassName,\/svg> \/svg>
23
<\/svg><\/svg>b[f]&&delete b[f],b.exportSVGElements[c]=a.destroy())}),a.length=0);d&&(t(d,function (a,c){clearTimeout(a.hideTimer);G(a,"mouseleave" );b.exportDivElements[c]=a.onmouseout=a.onmouseover=a.ontouchstart=a.onclick=null ;B(a)}),d.length=0);c&&(t(c,function (a){a()}),c.length=0)}});D.prototype.inlineToAttributes="fill stroke strokeLinecap strokeLinejoin strokeWidth textAnchor x y" .split(" " );D.prototype.inlineBlacklist=[/-/ ,/^(clipPath|cssText|d|height|width)$/ ,/^font$/ ,/[lL]ogical(Width|Height)$/ ,/perspective/ ,\/svg> \/svg>
24
<\/svg><\/svg>/TapHighlightColor/ ,/^transition/ ];D.prototype.unstyledElements=["clipPath" ,"defs" ,"desc" ];A.prototype.inlineStyles=function (){function a (a){return a.replace(/([A-Z])/ g,function (a,b){return "-" +b.toLowerCase()})}function b (d){var h,n,m,p="" ,r,q;if (1===d.nodeType&&-1===l.indexOf(d.nodeName)){n=z.getComputedStyle(d,null );m="svg" ===d.nodeName?{}:z.getComputedStyle(d.parentNode,null );g[d.nodeName]||(e||(e=u.createElementNS(f.SVG_NS,"svg" ),e.setAttribute("version" ,"1.1" ),u.body.appendChild(e)),r=u.createElementNS(d.namespaceURI,\/svg> \/svg>
25
<\/svg><\/svg>d.nodeName),e.appendChild(r),g[d.nodeName]=v(z.getComputedStyle(r,null )),e.removeChild(r));for (h in n){r=!1;for (q=k.length;q--&&!r;)r=k[q].test(h)||"function" ===typeof n[h];r||m[h]!==n[h]&&g[d.nodeName][h]!==n[h]&&(-1!==c.indexOf(h)?d.setAttribute(a(h),n[h]):p+=a(h)+":" +n[h]+";" )}p&&(h=d.getAttribute("style" ),d.setAttribute("style" ,(h?h+";" :"" )+p));"text" !==d.nodeName&&t(d.children||d.childNodes,b)}}var d=this .renderer,c=d.inlineToAttributes,k=d.inlineBlacklist,l=d.unstyledElements,g={},e;b(this .container.querySelector("svg" ));\/svg> \/svg>
26
<\/svg><\/svg>e.parentNode.removeChild(e)};H.menu=function (a,b,d,c){return ["M" ,a,b+2.5,"L" ,a+d,b+2.5,"M" ,a,b+c/2+.5,"L",a+d,b+c/ 2+.5,"M" ,a,b+c-1.5,"L" ,a+d,b+c-1.5]};A.prototype.renderExporting=function (){var a,b=this .options.exporting,d=b.buttons,c=this .isDirtyExporting||!this .exportSVGElements;this .buttonOffset=0;this .isDirtyExporting&&this .destroyExport();if (c&&!1!==b.enabled){this .exportEvents=[];for (a in d)this .addButton(d[a]);this .isDirtyExporting=!1}x(this ,"destroy" ,this .destroyExport)};A.prototype.callbacks.push(function (a){a.renderExporting();\/svg> \/svg>
27
<\/svg><\/svg>x(a,"redraw" ,a.renderExporting);t(["exporting" ,"navigation" ],function (b){a[b]={update:function (d,c){a.isDirtyExporting=!0;v(!0,a.options[b],d);C(c,!0)&&a.redraw()}}})})})(k)});\/svg> \/svg>