!function(m){var g,t=m.Chart,f=m.addEvent,o=m.removeEvent,b=m.createElement,s=m.discardElement,v=m.css,x=m.merge,w=m.each,S=m.extend,k=Math.max,l=document,a=window,e=m.isTouchDevice,n=m.Renderer.prototype.symbols,i=m.getOptions();S(i.lang,{printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",contextButtonTitle:"Chart context menu"}),i.navigation={menuStyle:{border:"1px solid #A0A0A0",background:"#FFFFFF",padding:"5px 0"},menuItemStyle:{padding:"0 10px",background:"none",color:"#303030",fontSize:e?"14px":"11px"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{symbolFill:"#E0E0E0",symbolSize:14,symbolStroke:"#666",symbolStrokeWidth:3,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,theme:{fill:"white",stroke:"none"},verticalAlign:"top",width:24}},i.exporting={type:"image/png",url:"http://export.highcharts.com/",buttons:{contextButton:{menuClassName:"highcharts-contextmenu",symbol:"menu",_titleKey:"contextButtonTitle",menuItems:[{textKey:"printChart",onclick:function(){this.print()}},{separator:!0},{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"})}}]}}},m.post=function(t,e){var n,o;for(n in o=b("form",{method:"post",action:t,enctype:"multipart/form-data"},{display:"none"},l.body),e)b("input",{type:"hidden",name:n,value:e[n]},null,o);o.submit(),s(o)},S(t.prototype,{getSVG:function(t){var a,e,n,o,i=this,r=x(i.options,t);return l.createElementNS||(l.createElementNS=function(t,e){return l.createElement(e)}),t=b("div",null,{position:"absolute",top:"-9999em",width:i.chartWidth+"px",height:i.chartHeight+"px"},l.body),e=i.renderTo.style.width,o=i.renderTo.style.height,e=r.exporting.sourceWidth||r.chart.width||/px$/.test(e)&&parseInt(e,10)||600,o=r.exporting.sourceHeight||r.chart.height||/px$/.test(o)&&parseInt(o,10)||400,S(r.chart,{animation:!1,renderTo:t,forExport:!0,width:e,height:o}),r.exporting.enabled=!1,r.series=[],w(i.series,function(t){(n=x(t.options,{animation:!1,showCheckbox:!1,visible:t.visible})).isInternal||r.series.push(n)}),a=new m.Chart(r,i.callback),w(["xAxis","yAxis"],function(r){w(i[r],function(t,e){var n=a[r][e],o=(i=t.getExtremes()).userMin,i=i.userMax;!n||void 0===o&&void 0===i||n.setExtremes(o,i,!0,!1)})}),e=a.container.innerHTML,r=null,a.destroy(),s(t),(e=e.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ href=/g," xlink:href=").replace(/\n/," ").replace(/<\/svg>.*?$/,"</svg>").replace(/ /g," ").replace(/­/g,"").replace(/<IMG /g,"<image ").replace(/height=([^" ]+)/g,'height="$1"').replace(/width=([^" ]+)/g,'width="$1"').replace(/hc-svg-href="([^"]+)">/g,'xlink:href="$1"/>').replace(/id=([^" >]+)/g,'id="$1"').replace(/class=([^" >]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:(path|rect)/g,"$1").replace(/style="([^"]+)"/g,function(t){return t.toLowerCase()})).replace(/(url\(#highcharts-[0-9]+)"/g,"$1").replace(/"/g,"'")},exportChart:function(t,e){t=t||{};var n=this.options.exporting;n=this.getSVG(x({chart:{borderRadius:0}},n.chartOptions,e,{exporting:{sourceWidth:t.sourceWidth||n.sourceWidth,sourceHeight:t.sourceHeight||n.sourceHeight}})),t=x(this.options.exporting,t);m.post(t.url,{filename:t.filename||"chart",type:t.type,width:t.width||0,scale:t.scale||2,svg:n})},print:function(){var t=this,e=t.container,n=[],o=e.parentNode,i=l.body,r=i.childNodes;t.isPrinting||(t.isPrinting=!0,w(r,function(t,e){1===t.nodeType&&(n[e]=t.style.display,t.style.display="none")}),i.appendChild(e),a.focus(),a.print(),setTimeout(function(){o.appendChild(e),w(r,function(t,e){1===t.nodeType&&(t.style.display=n[e])}),t.isPrinting=!1},1e3))},contextMenu:function(e,t,n,o,i,r,a){var s,l,p,c=this,h=c.options.navigation,u=h.menuItemStyle,d=c.chartWidth,m=c.chartHeight,g="cache-"+e,x=c[g],y=k(i,r);x||(c[g]=x=b("div",{className:e},{position:"absolute",zIndex:1e3,padding:y+"px"},c.container),s=b("div",null,S({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},h.menuStyle),x),l=function(){v(x,{display:"none"}),a&&a.setState(0),c.openMenu=!1},f(x,"mouseleave",function(){p=setTimeout(l,500)}),f(x,"mouseenter",function(){clearTimeout(p)}),f(document,"mousedown",function(t){c.pointer.inClass(t.target,e)||l()}),w(t,function(t){if(t){var e=t.separator?b("hr",null,null,s):b("div",{onmouseover:function(){v(this,h.menuItemHoverStyle)},onmouseout:function(){v(this,u)},onclick:function(){l(),t.onclick.apply(c,arguments)},innerHTML:t.text||c.options.lang[t.textKey]},S({cursor:"pointer"},u),s);c.exportDivElements.push(e)}}),c.exportDivElements.push(s,x),c.exportMenuWidth=x.offsetWidth,c.exportMenuHeight=x.offsetHeight),t={display:"block"},n+c.exportMenuWidth>d?t.right=d-n-i-y+"px":t.left=n-y+"px",o+r+c.exportMenuHeight>m&&"top"!==a.alignOptions.verticalAlign?t.bottom=m-o-y+"px":t.top=o+r-y+"px",v(x,t),c.openMenu=!0},addButton:function(t){var e,n,o=this,i=o.renderer,r=x(o.options.navigation.buttonOptions,t),a=r.onclick,s=r.menuItems,l={stroke:r.symbolStroke,fill:r.symbolFill},p=r.symbolSize||12;if(o.btnCount||(o.btnCount=0),o.exportDivElements||(o.exportDivElements=[],o.exportSVGElements=[]),!1!==r.enabled){var c,h=r.theme,u=(d=h.states)&&d.hover,d=d&&d.select;delete h.states,a?c=function(){a.apply(o,arguments)}:s&&(c=function(){o.contextMenu(n.menuClassName,s,n.translateX,n.translateY,n.width,n.height,n),n.setState(2)}),r.text&&r.symbol?h.paddingLeft=m.pick(h.paddingLeft,25):r.text||S(h,{width:r.width,height:r.height,padding:0}),(n=i.button(r.text,0,0,c,h,u,d).attr({title:o.options.lang[r._titleKey],"stroke-linecap":"round"})).menuClassName=t.menuClassName||"highcharts-menu-"+o.btnCount++,r.symbol&&(e=i.symbol(r.symbol,r.symbolX-p/2,r.symbolY-p/2,p,p).attr(S(l,{"stroke-width":r.symbolStrokeWidth||1,zIndex:1})).add(n)),n.add().align(S(r,{width:n.width,x:m.pick(r.x,g)}),!0,"spacingBox"),g+=(n.width+r.buttonSpacing)*("right"===r.align?-1:1),o.exportSVGElements.push(n,e)}},destroyExport:function(t){var e,n;t=t.target;for(e=0;e<t.exportSVGElements.length;e++)(n=t.exportSVGElements[e])&&(n.onclick=n.ontouchstart=null,t.exportSVGElements[e]=n.destroy());for(e=0;e<t.exportDivElements.length;e++)n=t.exportDivElements[e],o(n,"mouseleave"),t.exportDivElements[e]=n.onmouseout=n.onmouseover=n.ontouchstart=n.onclick=null,s(n)}}),n.menu=function(t,e,n,o){return["M",t,e+2.5,"L",t+n,e+2.5,"M",t,e+o/2+.5,"L",t+n,e+o/2+.5,"M",t,e+o-1.5,"L",t+n,e+o-1.5]},t.prototype.callbacks.push(function(t){var e,n=t.options.exporting,o=n.buttons;if(g=0,!1!==n.enabled){for(e in o)t.addButton(o[e]);f(t,"destroy",t.destroyExport)}})}(Highcharts);
|