Showing
3 changed files
with
675 additions
and
95 deletions
This diff could not be displayed because it is too large.
| ... | @@ -6,24 +6,588 @@ | ... | @@ -6,24 +6,588 @@ |
| 6 | 6 | ||
| 7 | License: www.highcharts.com/license | 7 | License: www.highcharts.com/license |
| 8 | */ | 8 | */ |
| 9 | -(function(g){"object"===typeof module&&module.exports?module.exports=g:"function"===typeof define&&define.amd?define(function(){return g}):g(Highcharts)})(function(g){(function(f){var g=f.defaultOptions,y=f.doc,z=f.Chart,q=f.addEvent,H=f.removeEvent,B=f.fireEvent,r=f.createElement,C=f.discardElement,u=f.css,p=f.merge,A=f.pick,l=f.each,E=f.objectEach,t=f.extend,I=f.isTouchDevice,D=f.win,F=D.navigator.userAgent,J=f.Renderer.prototype.symbols;/Edge\/|Trident\/|MSIE /.test(F);/firefox/i.test(F);t(g.lang, | 9 | +(function(g) { |
| 10 | -{printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",contextButtonTitle:"Chart context menu"});g.navigation={buttonOptions:{theme:{},symbolSize:14,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,verticalAlign:"top",width:24}};p(!0,g.navigation,{menuStyle:{border:"1px solid #999999",background:"#ffffff",padding:"5px 0"},menuItemStyle:{padding:"0.5em 1em",background:"none", | 10 | + "object" === typeof module && module.exports |
| 11 | -color:"#333333",fontSize:I?"14px":"11px",transition:"background 250ms, color 250ms"},menuItemHoverStyle:{background:"#335cad",color:"#ffffff"},buttonOptions:{symbolFill:"#666666",symbolStroke:"#666666",symbolStrokeWidth:3,theme:{fill:"#ffffff",stroke:"none",padding:5}}});g.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", | 11 | + ? (module.exports = g) |
| 12 | -menuItems:"printChart separator downloadPNG downloadJPEG downloadPDF downloadSVG".split(" ")}},menuItemDefinitions:{printChart:{textKey:"printChart",onclick:function(){this.print()}},separator:{separator:!0},downloadPNG:{textKey:"downloadPNG",onclick:function(){this.exportChart()}},downloadJPEG:{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},downloadPDF:{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},downloadSVG:{textKey:"downloadSVG", | 12 | + : "function" === typeof define && define.amd |
| 13 | -onclick:function(){this.exportChart({type:"image/svg+xml"})}}}};f.post=function(a,b,e){var c=r("form",p({method:"post",action:a,enctype:"multipart/form-data"},e),{display:"none"},y.body);E(b,function(a,b){r("input",{type:"hidden",name:b,value:a},null,c)});c.submit();C(c)};t(z.prototype,{sanitizeSVG:function(a,b){if(b&&b.exporting&&b.exporting.allowHTML){var e=a.match(/<\/svg>(.*?$)/);e&&e[1]&&(e='\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'+ | 13 | + ? define(function() { |
| 14 | -e[1]+"\x3c/body\x3e\x3c/foreignObject\x3e",a=a.replace("\x3c/svg\x3e",e+"\x3c/svg\x3e"))}a=a.replace(/zIndex="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|")(\S+)("|")\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'\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, | 14 | + return g; |
| 15 | -'$1\x3d"rgb($2)" $1-opacity\x3d"$3"').replace(/ /g,"\u00a0").replace(/­/g,"\u00ad");this.ieSanitizeSVG&&(a=this.ieSanitizeSVG(a));return a},getChartHTML:function(){return this.container.innerHTML},getSVG:function(a){var b,e,c,v,m,h=p(this.options,a);e=r("div",null,{position:"absolute",top:"-9999em",width:this.chartWidth+"px",height:this.chartHeight+"px"},y.body);c=this.renderTo.style.width;m=this.renderTo.style.height;c=h.exporting.sourceWidth||h.chart.width||/px$/.test(c)&&parseInt(c,10)|| | 15 | + }) |
| 16 | -600;m=h.exporting.sourceHeight||h.chart.height||/px$/.test(m)&&parseInt(m,10)||400;t(h.chart,{animation:!1,renderTo:e,forExport:!0,renderer:"SVGRenderer",width:c,height:m});h.exporting.enabled=!1;delete h.data;h.series=[];l(this.series,function(a){v=p(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});v.isInternal||h.series.push(v)});l(this.axes,function(a){a.userOptions.internalKey||(a.userOptions.internalKey=f.uniqueKey())});b=new f.Chart(h,this.callback);a&& | 16 | + : g(Highcharts); |
| 17 | -l(["xAxis","yAxis","series"],function(c){var d={};a[c]&&(d[c]=a[c],b.update(d))});l(this.axes,function(a){var c=f.find(b.axes,function(b){return b.options.internalKey===a.userOptions.internalKey}),d=a.getExtremes(),e=d.userMin,d=d.userMax;c&&(void 0!==e&&e!==c.min||void 0!==d&&d!==c.max)&&c.setExtremes(e,d,!0,!1)});c=b.getChartHTML();B(this,"getSVG",{chartCopy:b});c=this.sanitizeSVG(c,h);h=null;b.destroy();C(e);return c},getSVGForExport:function(a,b){var e=this.options.exporting;return this.getSVG(p({chart:{borderRadius:0}}, | 17 | +})(function(g) { |
| 18 | -e.chartOptions,b,{exporting:{sourceWidth:a&&a.sourceWidth||e.sourceWidth,sourceHeight:a&&a.sourceHeight||e.sourceHeight}}))},exportChart:function(a,b){b=this.getSVGForExport(a,b);a=p(this.options.exporting,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,e=[],c=b.parentNode,f=y.body,m=f.childNodes,h=a.options.exporting.printMaxWidth,d,n;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null, | 18 | + (function(f) { |
| 19 | -0);B(a,"beforePrint");if(n=h&&a.chartWidth>h)d=[a.options.chart.width,void 0,!1],a.setSize(h,void 0,!1);l(m,function(a,b){1===a.nodeType&&(e[b]=a.style.display,a.style.display="none")});f.appendChild(b);setTimeout(function(){D.focus();D.print();setTimeout(function(){c.appendChild(b);l(m,function(a,b){1===a.nodeType&&(a.style.display=e[b])});a.isPrinting=!1;n&&a.setSize.apply(a,d);B(a,"afterPrint")},1E3)},1)}},contextMenu:function(a,b,e,c,v,m,h){var d=this,n=d.options.navigation,g=d.chartWidth,G=d.chartHeight, | 19 | + var g = f.defaultOptions, |
| 20 | -p="cache-"+a,k=d[p],w=Math.max(v,m),x;k||(d.exportContextMenu=d[p]=k=r("div",{className:a},{position:"absolute",zIndex:1E3,padding:w+"px",pointerEvents:"auto"},d.fixedDiv||d.container),x=r("div",{className:"highcharts-menu"},null,k),u(x,t({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},n.menuStyle)),k.hideMenu=function(){u(k,{display:"none"});h&&h.setState(0);d.openMenu=!1;f.clearTimeout(k.hideTimer)},d.exportEvents.push(q(k,"mouseleave",function(){k.hideTimer= | 20 | + y = f.doc, |
| 21 | -setTimeout(k.hideMenu,500)}),q(k,"mouseenter",function(){f.clearTimeout(k.hideTimer)}),q(y,"mouseup",function(b){d.pointer.inClass(b.target,a)||k.hideMenu()}),q(k,"click",function(){d.openMenu&&k.hideMenu()})),l(b,function(a){"string"===typeof a&&(a=d.options.exporting.menuItemDefinitions[a]);if(f.isObject(a,!0)){var b;a.separator?b=r("hr",null,null,x):(b=r("div",{className:"highcharts-menu-item",onclick:function(b){b&&b.stopPropagation();k.hideMenu();a.onclick&&a.onclick.apply(d,arguments)},innerHTML:a.text|| | 21 | + z = f.Chart, |
| 22 | -d.options.lang[a.textKey]},null,x),b.onmouseover=function(){u(this,n.menuItemHoverStyle)},b.onmouseout=function(){u(this,n.menuItemStyle)},u(b,t({cursor:"pointer"},n.menuItemStyle)));d.exportDivElements.push(b)}}),d.exportDivElements.push(x,k),d.exportMenuWidth=k.offsetWidth,d.exportMenuHeight=k.offsetHeight);b={display:"block"};e+d.exportMenuWidth>g?b.right=g-e-v-w+"px":b.left=e-w+"px";c+m+d.exportMenuHeight>G&&"top"!==h.alignOptions.verticalAlign?b.bottom=G-c-w+"px":b.top=c+m-w+"px";u(k,b);d.openMenu= | 22 | + q = f.addEvent, |
| 23 | -!0},addButton:function(a){var b=this,e=b.renderer,c=p(b.options.navigation.buttonOptions,a),f=c.onclick,m=c.menuItems,h,d,n=c.symbolSize||12;b.btnCount||(b.btnCount=0);b.exportDivElements||(b.exportDivElements=[],b.exportSVGElements=[]);if(!1!==c.enabled){var g=c.theme,l=g.states,q=l&&l.hover,l=l&&l.select,k;delete g.states;f?k=function(a){a&&a.stopPropagation();f.call(b,a)}:m&&(k=function(a){a&&a.stopPropagation();b.contextMenu(d.menuClassName,m,d.translateX,d.translateY,d.width,d.height,d);d.setState(2)}); | 23 | + H = f.removeEvent, |
| 24 | -c.text&&c.symbol?g.paddingLeft=A(g.paddingLeft,25):c.text||t(g,{width:c.width,height:c.height,padding:0});d=e.button(c.text,0,0,k,g,q,l).addClass(a.className).attr({"stroke-linecap":"round",title:A(b.options.lang[c._titleKey||c.titleKey],"")});d.menuClassName=a.menuClassName||"highcharts-menu-"+b.btnCount++;c.symbol&&(h=e.symbol(c.symbol,c.symbolX-n/2,c.symbolY-n/2,n,n,{width:n,height:n}).addClass("highcharts-button-symbol").attr({zIndex:1}).add(d),h.attr({stroke:c.symbolStroke,fill:c.symbolFill, | 24 | + B = f.fireEvent, |
| 25 | -"stroke-width":c.symbolStrokeWidth||1}));d.add(b.exportingGroup).align(t(c,{width:d.width,x:A(c.x,b.buttonOffset)}),!0,"spacingBox");b.buttonOffset+=(d.width+c.buttonSpacing)*("right"===c.align?-1:1);b.exportSVGElements.push(d,h)}},destroyExport:function(a){var b=a?a.target:this;a=b.exportSVGElements;var e=b.exportDivElements,c=b.exportEvents,g;a&&(l(a,function(a,c){a&&(a.onclick=a.ontouchstart=null,g="cache-"+a.menuClassName,b[g]&&delete b[g],b.exportSVGElements[c]=a.destroy())}),a.length=0);b.exportingGroup&& | 25 | + r = f.createElement, |
| 26 | -(b.exportingGroup.destroy(),delete b.exportingGroup);e&&(l(e,function(a,c){f.clearTimeout(a.hideTimer);H(a,"mouseleave");b.exportDivElements[c]=a.onmouseout=a.onmouseover=a.ontouchstart=a.onclick=null;C(a)}),e.length=0);c&&(l(c,function(a){a()}),c.length=0)}});J.menu=function(a,b,e,c){return["M",a,b+2.5,"L",a+e,b+2.5,"M",a,b+c/2+.5,"L",a+e,b+c/2+.5,"M",a,b+c-1.5,"L",a+e,b+c-1.5]};z.prototype.renderExporting=function(){var a=this,b=a.options.exporting,e=b.buttons,c=a.isDirtyExporting||!a.exportSVGElements; | 26 | + C = f.discardElement, |
| 27 | -a.buttonOffset=0;a.isDirtyExporting&&a.destroyExport();c&&!1!==b.enabled&&(a.exportEvents=[],a.exportingGroup=a.exportingGroup||a.renderer.g("exporting-group").attr({zIndex:3}).add(),E(e,function(b){a.addButton(b)}),a.isDirtyExporting=!1);q(a,"destroy",a.destroyExport)};q(z,"init",function(){var a=this;l(["exporting","navigation"],function(b){a[b]={update:function(e,c){a.isDirtyExporting=!0;p(!0,a.options[b],e);A(c,!0)&&a.redraw()}}})});z.prototype.callbacks.push(function(a){a.renderExporting();q(a, | 27 | + u = f.css, |
| 28 | -"redraw",a.renderExporting)})})(g)}); | 28 | + p = f.merge, |
| 29 | + A = f.pick, | ||
| 30 | + l = f.each, | ||
| 31 | + E = f.objectEach, | ||
| 32 | + t = f.extend, | ||
| 33 | + I = f.isTouchDevice, | ||
| 34 | + D = f.win, | ||
| 35 | + F = D.navigator.userAgent, | ||
| 36 | + J = f.Renderer.prototype.symbols; | ||
| 37 | + /Edge\/|Trident\/|MSIE /.test(F); | ||
| 38 | + /firefox/i.test(F); | ||
| 39 | + t(g.lang, { | ||
| 40 | + printChart: "Print chart", | ||
| 41 | + downloadPNG: "Download PNG image", | ||
| 42 | + downloadJPEG: "Download JPEG image", | ||
| 43 | + downloadPDF: "Download PDF document", | ||
| 44 | + downloadSVG: "Download SVG vector image", | ||
| 45 | + contextButtonTitle: "Chart context menu" | ||
| 46 | + }); | ||
| 47 | + g.navigation = { | ||
| 48 | + buttonOptions: { | ||
| 49 | + theme: {}, | ||
| 50 | + symbolSize: 14, | ||
| 51 | + symbolX: 12.5, | ||
| 52 | + symbolY: 10.5, | ||
| 53 | + align: "right", | ||
| 54 | + buttonSpacing: 3, | ||
| 55 | + height: 22, | ||
| 56 | + verticalAlign: "top", | ||
| 57 | + width: 24 | ||
| 58 | + } | ||
| 59 | + }; | ||
| 60 | + p(!0, g.navigation, { | ||
| 61 | + menuStyle: { | ||
| 62 | + border: "1px solid #999999", | ||
| 63 | + background: "#ffffff", | ||
| 64 | + padding: "5px 0" | ||
| 65 | + }, | ||
| 66 | + menuItemStyle: { | ||
| 67 | + padding: "0.5em 1em", | ||
| 68 | + background: "none", | ||
| 69 | + color: "#333333", | ||
| 70 | + fontSize: I ? "14px" : "11px", | ||
| 71 | + transition: "background 250ms, color 250ms" | ||
| 72 | + }, | ||
| 73 | + menuItemHoverStyle: { background: "#335cad", color: "#ffffff" }, | ||
| 74 | + buttonOptions: { | ||
| 75 | + symbolFill: "#666666", | ||
| 76 | + symbolStroke: "#666666", | ||
| 77 | + symbolStrokeWidth: 3, | ||
| 78 | + theme: { fill: "#ffffff", stroke: "none", padding: 5 } | ||
| 79 | + } | ||
| 80 | + }); | ||
| 81 | + g.exporting = { | ||
| 82 | + type: "image/png", | ||
| 83 | + url: "https://export.highcharts.com/", | ||
| 84 | + printMaxWidth: 780, | ||
| 85 | + scale: 2, | ||
| 86 | + buttons: { | ||
| 87 | + contextButton: { | ||
| 88 | + className: "highcharts-contextbutton", | ||
| 89 | + menuClassName: "highcharts-contextmenu", | ||
| 90 | + symbol: "menu", | ||
| 91 | + titleKey: "contextButtonTitle", | ||
| 92 | + menuItems: "printChart separator downloadPNG downloadJPEG downloadPDF downloadSVG".split( | ||
| 93 | + " " | ||
| 94 | + ) | ||
| 95 | + } | ||
| 96 | + }, | ||
| 97 | + menuItemDefinitions: { | ||
| 98 | + printChart: { | ||
| 99 | + textKey: "printChart", | ||
| 100 | + onclick: function() { | ||
| 101 | + this.print(); | ||
| 102 | + } | ||
| 103 | + }, | ||
| 104 | + separator: { separator: !0 }, | ||
| 105 | + downloadPNG: { | ||
| 106 | + textKey: "downloadPNG", | ||
| 107 | + onclick: function() { | ||
| 108 | + this.exportChart(); | ||
| 109 | + } | ||
| 110 | + }, | ||
| 111 | + downloadJPEG: { | ||
| 112 | + textKey: "downloadJPEG", | ||
| 113 | + onclick: function() { | ||
| 114 | + this.exportChart({ type: "image/jpeg" }); | ||
| 115 | + } | ||
| 116 | + }, | ||
| 117 | + downloadPDF: { | ||
| 118 | + textKey: "downloadPDF", | ||
| 119 | + onclick: function() { | ||
| 120 | + this.exportChart({ type: "application/pdf" }); | ||
| 121 | + } | ||
| 122 | + }, | ||
| 123 | + downloadSVG: { | ||
| 124 | + textKey: "downloadSVG", | ||
| 125 | + onclick: function() { | ||
| 126 | + this.exportChart({ type: "image/svg+xml" }); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + }; | ||
| 131 | + f.post = function(a, b, e) { | ||
| 132 | + var c = r( | ||
| 133 | + "form", | ||
| 134 | + p({ method: "post", action: a, enctype: "multipart/form-data" }, e), | ||
| 135 | + { display: "none" }, | ||
| 136 | + y.body | ||
| 137 | + ); | ||
| 138 | + E(b, function(a, b) { | ||
| 139 | + r("input", { type: "hidden", name: b, value: a }, null, c); | ||
| 140 | + }); | ||
| 141 | + c.submit(); | ||
| 142 | + C(c); | ||
| 143 | + }; | ||
| 144 | + t(z.prototype, { | ||
| 145 | + sanitizeSVG: function(a, b) { | ||
| 146 | + if (b && b.exporting && b.exporting.allowHTML) { | ||
| 147 | + var e = a.match(/<\/svg>(.*?$)/); | ||
| 148 | + e && | ||
| 149 | + e[1] && | ||
| 150 | + ((e = | ||
| 151 | + '\x3cforeignObject x\x3d"0" y\x3d"0" width\x3d"' + | ||
| 152 | + b.chart.width + | ||
| 153 | + '" height\x3d"' + | ||
| 154 | + b.chart.height + | ||
| 155 | + '"\x3e\x3cbody xmlns\x3d"http://www.w3.org/1999/xhtml"\x3e' + | ||
| 156 | + e[1] + | ||
| 157 | + "\x3c/body\x3e\x3c/foreignObject\x3e"), | ||
| 158 | + (a = a.replace("\x3c/svg\x3e", e + "\x3c/svg\x3e"))); | ||
| 159 | + } | ||
| 160 | + a = a | ||
| 161 | + .replace(/zIndex="[^"]+"/g, "") | ||
| 162 | + .replace(/symbolName="[^"]+"/g, "") | ||
| 163 | + .replace(/jQuery[0-9]+="[^"]+"/g, "") | ||
| 164 | + .replace(/url\(("|")(\S+)("|")\)/g, "url($2)") | ||
| 165 | + .replace(/url\([^#]+#/g, "url(#") | ||
| 166 | + .replace( | ||
| 167 | + /<svg /, | ||
| 168 | + '\x3csvg xmlns:xlink\x3d"http://www.w3.org/1999/xlink" ' | ||
| 169 | + ) | ||
| 170 | + .replace(/ (|NS[0-9]+\:)href=/g, " xlink:href\x3d") | ||
| 171 | + .replace(/\n/, " ") | ||
| 172 | + .replace(/<\/svg>.*?$/, "\x3c/svg\x3e") | ||
| 173 | + .replace( | ||
| 174 | + /(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, | ||
| 175 | + '$1\x3d"rgb($2)" $1-opacity\x3d"$3"' | ||
| 176 | + ) | ||
| 177 | + .replace(/ /g, "\u00a0") | ||
| 178 | + .replace(/­/g, "\u00ad"); | ||
| 179 | + this.ieSanitizeSVG && (a = this.ieSanitizeSVG(a)); | ||
| 180 | + return a; | ||
| 181 | + }, | ||
| 182 | + getChartHTML: function() { | ||
| 183 | + return this.container.innerHTML; | ||
| 184 | + }, | ||
| 185 | + getSVG: function(a) { | ||
| 186 | + var b, | ||
| 187 | + e, | ||
| 188 | + c, | ||
| 189 | + v, | ||
| 190 | + m, | ||
| 191 | + h = p(this.options, a); | ||
| 192 | + e = r( | ||
| 193 | + "div", | ||
| 194 | + null, | ||
| 195 | + { | ||
| 196 | + position: "absolute", | ||
| 197 | + top: "-9999em", | ||
| 198 | + width: this.chartWidth + "px", | ||
| 199 | + height: this.chartHeight + "px" | ||
| 200 | + }, | ||
| 201 | + y.body | ||
| 202 | + ); | ||
| 203 | + c = this.renderTo.style.width; | ||
| 204 | + m = this.renderTo.style.height; | ||
| 205 | + c = | ||
| 206 | + h.exporting.sourceWidth || | ||
| 207 | + h.chart.width || | ||
| 208 | + (/px$/.test(c) && parseInt(c, 10)) || | ||
| 209 | + 600; | ||
| 210 | + m = | ||
| 211 | + h.exporting.sourceHeight || | ||
| 212 | + h.chart.height || | ||
| 213 | + (/px$/.test(m) && parseInt(m, 10)) || | ||
| 214 | + 400; | ||
| 215 | + t(h.chart, { | ||
| 216 | + animation: !1, | ||
| 217 | + renderTo: e, | ||
| 218 | + forExport: !0, | ||
| 219 | + renderer: "SVGRenderer", | ||
| 220 | + width: c, | ||
| 221 | + height: m | ||
| 222 | + }); | ||
| 223 | + h.exporting.enabled = !1; | ||
| 224 | + delete h.data; | ||
| 225 | + h.series = []; | ||
| 226 | + l(this.series, function(a) { | ||
| 227 | + v = p(a.userOptions, { | ||
| 228 | + animation: !1, | ||
| 229 | + enableMouseTracking: !1, | ||
| 230 | + showCheckbox: !1, | ||
| 231 | + visible: a.visible | ||
| 232 | + }); | ||
| 233 | + v.isInternal || h.series.push(v); | ||
| 234 | + }); | ||
| 235 | + l(this.axes, function(a) { | ||
| 236 | + a.userOptions.internalKey || | ||
| 237 | + (a.userOptions.internalKey = f.uniqueKey()); | ||
| 238 | + }); | ||
| 239 | + b = new f.Chart(h, this.callback); | ||
| 240 | + a && | ||
| 241 | + l(["xAxis", "yAxis", "series"], function(c) { | ||
| 242 | + var d = {}; | ||
| 243 | + a[c] && ((d[c] = a[c]), b.update(d)); | ||
| 244 | + }); | ||
| 245 | + l(this.axes, function(a) { | ||
| 246 | + var c = f.find(b.axes, function(b) { | ||
| 247 | + return b.options.internalKey === a.userOptions.internalKey; | ||
| 248 | + }), | ||
| 249 | + d = a.getExtremes(), | ||
| 250 | + e = d.userMin, | ||
| 251 | + d = d.userMax; | ||
| 252 | + c && | ||
| 253 | + ((void 0 !== e && e !== c.min) || (void 0 !== d && d !== c.max)) && | ||
| 254 | + c.setExtremes(e, d, !0, !1); | ||
| 255 | + }); | ||
| 256 | + c = b.getChartHTML(); | ||
| 257 | + B(this, "getSVG", { chartCopy: b }); | ||
| 258 | + c = this.sanitizeSVG(c, h); | ||
| 259 | + h = null; | ||
| 260 | + b.destroy(); | ||
| 261 | + C(e); | ||
| 262 | + return c; | ||
| 263 | + }, | ||
| 264 | + getSVGForExport: function(a, b) { | ||
| 265 | + var e = this.options.exporting; | ||
| 266 | + return this.getSVG( | ||
| 267 | + p({ chart: { borderRadius: 0 } }, e.chartOptions, b, { | ||
| 268 | + exporting: { | ||
| 269 | + sourceWidth: (a && a.sourceWidth) || e.sourceWidth, | ||
| 270 | + sourceHeight: (a && a.sourceHeight) || e.sourceHeight | ||
| 271 | + } | ||
| 272 | + }) | ||
| 273 | + ); | ||
| 274 | + }, | ||
| 275 | + exportChart: function(a, b) { | ||
| 276 | + b = this.getSVGForExport(a, b); | ||
| 277 | + a = p(this.options.exporting, a); | ||
| 278 | + f.post( | ||
| 279 | + a.url, | ||
| 280 | + { | ||
| 281 | + filename: a.filename || "chart", | ||
| 282 | + type: a.type, | ||
| 283 | + width: a.width || 0, | ||
| 284 | + scale: a.scale, | ||
| 285 | + svg: b | ||
| 286 | + }, | ||
| 287 | + a.formAttributes | ||
| 288 | + ); | ||
| 289 | + }, | ||
| 290 | + print: function() { | ||
| 291 | + var a = this, | ||
| 292 | + b = a.container, | ||
| 293 | + e = [], | ||
| 294 | + c = b.parentNode, | ||
| 295 | + f = y.body, | ||
| 296 | + m = f.childNodes, | ||
| 297 | + h = a.options.exporting.printMaxWidth, | ||
| 298 | + d, | ||
| 299 | + n; | ||
| 300 | + if (!a.isPrinting) { | ||
| 301 | + a.isPrinting = !0; | ||
| 302 | + a.pointer.reset(null, 0); | ||
| 303 | + B(a, "beforePrint"); | ||
| 304 | + if ((n = h && a.chartWidth > h)) | ||
| 305 | + (d = [a.options.chart.width, void 0, !1]), a.setSize(h, void 0, !1); | ||
| 306 | + l(m, function(a, b) { | ||
| 307 | + 1 === a.nodeType && | ||
| 308 | + ((e[b] = a.style.display), (a.style.display = "none")); | ||
| 309 | + }); | ||
| 310 | + f.appendChild(b); | ||
| 311 | + setTimeout(function() { | ||
| 312 | + D.focus(); | ||
| 313 | + D.print(); | ||
| 314 | + setTimeout(function() { | ||
| 315 | + c.appendChild(b); | ||
| 316 | + l(m, function(a, b) { | ||
| 317 | + 1 === a.nodeType && (a.style.display = e[b]); | ||
| 318 | + }); | ||
| 319 | + a.isPrinting = !1; | ||
| 320 | + n && a.setSize.apply(a, d); | ||
| 321 | + B(a, "afterPrint"); | ||
| 322 | + }, 1e3); | ||
| 323 | + }, 1); | ||
| 324 | + } | ||
| 325 | + }, | ||
| 326 | + contextMenu: function(a, b, e, c, v, m, h) { | ||
| 327 | + var d = this, | ||
| 328 | + n = d.options.navigation, | ||
| 329 | + g = d.chartWidth, | ||
| 330 | + G = d.chartHeight, | ||
| 331 | + p = "cache-" + a, | ||
| 332 | + k = d[p], | ||
| 333 | + w = Math.max(v, m), | ||
| 334 | + x; | ||
| 335 | + k || | ||
| 336 | + ((d.exportContextMenu = d[p] = k = r( | ||
| 337 | + "div", | ||
| 338 | + { className: a }, | ||
| 339 | + { | ||
| 340 | + position: "absolute", | ||
| 341 | + zIndex: 1e3, | ||
| 342 | + padding: w + "px", | ||
| 343 | + pointerEvents: "auto" | ||
| 344 | + }, | ||
| 345 | + d.fixedDiv || d.container | ||
| 346 | + )), | ||
| 347 | + (x = r("div", { className: "highcharts-menu" }, null, k)), | ||
| 348 | + u( | ||
| 349 | + x, | ||
| 350 | + t( | ||
| 351 | + { | ||
| 352 | + MozBoxShadow: "3px 3px 10px #888", | ||
| 353 | + WebkitBoxShadow: "3px 3px 10px #888", | ||
| 354 | + boxShadow: "3px 3px 10px #888" | ||
| 355 | + }, | ||
| 356 | + n.menuStyle | ||
| 357 | + ) | ||
| 358 | + ), | ||
| 359 | + (k.hideMenu = function() { | ||
| 360 | + u(k, { display: "none" }); | ||
| 361 | + h && h.setState(0); | ||
| 362 | + d.openMenu = !1; | ||
| 363 | + f.clearTimeout(k.hideTimer); | ||
| 364 | + }), | ||
| 365 | + d.exportEvents.push( | ||
| 366 | + q(k, "mouseleave", function() { | ||
| 367 | + k.hideTimer = setTimeout(k.hideMenu, 500); | ||
| 368 | + }), | ||
| 369 | + q(k, "mouseenter", function() { | ||
| 370 | + f.clearTimeout(k.hideTimer); | ||
| 371 | + }), | ||
| 372 | + q(y, "mouseup", function(b) { | ||
| 373 | + d.pointer.inClass(b.target, a) || k.hideMenu(); | ||
| 374 | + }), | ||
| 375 | + q(k, "click", function() { | ||
| 376 | + d.openMenu && k.hideMenu(); | ||
| 377 | + }) | ||
| 378 | + ), | ||
| 379 | + l(b, function(a) { | ||
| 380 | + "string" === typeof a && | ||
| 381 | + (a = d.options.exporting.menuItemDefinitions[a]); | ||
| 382 | + if (f.isObject(a, !0)) { | ||
| 383 | + var b; | ||
| 384 | + a.separator | ||
| 385 | + ? (b = r("hr", null, null, x)) | ||
| 386 | + : ((b = r( | ||
| 387 | + "div", | ||
| 388 | + { | ||
| 389 | + className: "highcharts-menu-item", | ||
| 390 | + onclick: function(b) { | ||
| 391 | + b && b.stopPropagation(); | ||
| 392 | + k.hideMenu(); | ||
| 393 | + a.onclick && a.onclick.apply(d, arguments); | ||
| 394 | + }, | ||
| 395 | + innerHTML: a.text || d.options.lang[a.textKey] | ||
| 396 | + }, | ||
| 397 | + null, | ||
| 398 | + x | ||
| 399 | + )), | ||
| 400 | + (b.onmouseover = function() { | ||
| 401 | + u(this, n.menuItemHoverStyle); | ||
| 402 | + }), | ||
| 403 | + (b.onmouseout = function() { | ||
| 404 | + u(this, n.menuItemStyle); | ||
| 405 | + }), | ||
| 406 | + u(b, t({ cursor: "pointer" }, n.menuItemStyle))); | ||
| 407 | + d.exportDivElements.push(b); | ||
| 408 | + } | ||
| 409 | + }), | ||
| 410 | + d.exportDivElements.push(x, k), | ||
| 411 | + (d.exportMenuWidth = k.offsetWidth), | ||
| 412 | + (d.exportMenuHeight = k.offsetHeight)); | ||
| 413 | + b = { display: "block" }; | ||
| 414 | + e + d.exportMenuWidth > g | ||
| 415 | + ? (b.right = g - e - v - w + "px") | ||
| 416 | + : (b.left = e - w + "px"); | ||
| 417 | + c + m + d.exportMenuHeight > G && "top" !== h.alignOptions.verticalAlign | ||
| 418 | + ? (b.bottom = G - c - w + "px") | ||
| 419 | + : (b.top = c + m - w + "px"); | ||
| 420 | + u(k, b); | ||
| 421 | + d.openMenu = !0; | ||
| 422 | + }, | ||
| 423 | + addButton: function(a) { | ||
| 424 | + var b = this, | ||
| 425 | + e = b.renderer, | ||
| 426 | + c = p(b.options.navigation.buttonOptions, a), | ||
| 427 | + f = c.onclick, | ||
| 428 | + m = c.menuItems, | ||
| 429 | + h, | ||
| 430 | + d, | ||
| 431 | + n = c.symbolSize || 12; | ||
| 432 | + b.btnCount || (b.btnCount = 0); | ||
| 433 | + b.exportDivElements || | ||
| 434 | + ((b.exportDivElements = []), (b.exportSVGElements = [])); | ||
| 435 | + if (!1 !== c.enabled) { | ||
| 436 | + var g = c.theme, | ||
| 437 | + l = g.states, | ||
| 438 | + q = l && l.hover, | ||
| 439 | + l = l && l.select, | ||
| 440 | + k; | ||
| 441 | + delete g.states; | ||
| 442 | + f | ||
| 443 | + ? (k = function(a) { | ||
| 444 | + a && a.stopPropagation(); | ||
| 445 | + f.call(b, a); | ||
| 446 | + }) | ||
| 447 | + : m && | ||
| 448 | + (k = function(a) { | ||
| 449 | + a && a.stopPropagation(); | ||
| 450 | + b.contextMenu( | ||
| 451 | + d.menuClassName, | ||
| 452 | + m, | ||
| 453 | + d.translateX, | ||
| 454 | + d.translateY, | ||
| 455 | + d.width, | ||
| 456 | + d.height, | ||
| 457 | + d | ||
| 458 | + ); | ||
| 459 | + d.setState(2); | ||
| 460 | + }); | ||
| 461 | + c.text && c.symbol | ||
| 462 | + ? (g.paddingLeft = A(g.paddingLeft, 25)) | ||
| 463 | + : c.text || t(g, { width: c.width, height: c.height, padding: 0 }); | ||
| 464 | + d = e | ||
| 465 | + .button(c.text, 0, 0, k, g, q, l) | ||
| 466 | + .addClass(a.className) | ||
| 467 | + .attr({ | ||
| 468 | + "stroke-linecap": "round", | ||
| 469 | + title: A(b.options.lang[c._titleKey || c.titleKey], "") | ||
| 470 | + }); | ||
| 471 | + d.menuClassName = | ||
| 472 | + a.menuClassName || "highcharts-menu-" + b.btnCount++; | ||
| 473 | + c.symbol && | ||
| 474 | + ((h = e | ||
| 475 | + .symbol(c.symbol, c.symbolX - n / 2, c.symbolY - n / 2, n, n, { | ||
| 476 | + width: n, | ||
| 477 | + height: n | ||
| 478 | + }) | ||
| 479 | + .addClass("highcharts-button-symbol") | ||
| 480 | + .attr({ zIndex: 1 }) | ||
| 481 | + .add(d)), | ||
| 482 | + h.attr({ | ||
| 483 | + stroke: c.symbolStroke, | ||
| 484 | + fill: c.symbolFill, | ||
| 485 | + "stroke-width": c.symbolStrokeWidth || 1 | ||
| 486 | + })); | ||
| 487 | + d.add(b.exportingGroup).align( | ||
| 488 | + t(c, { width: d.width, x: A(c.x, b.buttonOffset) }), | ||
| 489 | + !0, | ||
| 490 | + "spacingBox" | ||
| 491 | + ); | ||
| 492 | + b.buttonOffset += | ||
| 493 | + (d.width + c.buttonSpacing) * ("right" === c.align ? -1 : 1); | ||
| 494 | + b.exportSVGElements.push(d, h); | ||
| 495 | + } | ||
| 496 | + }, | ||
| 497 | + destroyExport: function(a) { | ||
| 498 | + var b = a ? a.target : this; | ||
| 499 | + a = b.exportSVGElements; | ||
| 500 | + var e = b.exportDivElements, | ||
| 501 | + c = b.exportEvents, | ||
| 502 | + g; | ||
| 503 | + a && | ||
| 504 | + (l(a, function(a, c) { | ||
| 505 | + a && | ||
| 506 | + ((a.onclick = a.ontouchstart = null), | ||
| 507 | + (g = "cache-" + a.menuClassName), | ||
| 508 | + b[g] && delete b[g], | ||
| 509 | + (b.exportSVGElements[c] = a.destroy())); | ||
| 510 | + }), | ||
| 511 | + (a.length = 0)); | ||
| 512 | + b.exportingGroup && | ||
| 513 | + (b.exportingGroup.destroy(), delete b.exportingGroup); | ||
| 514 | + e && | ||
| 515 | + (l(e, function(a, c) { | ||
| 516 | + f.clearTimeout(a.hideTimer); | ||
| 517 | + H(a, "mouseleave"); | ||
| 518 | + b.exportDivElements[ | ||
| 519 | + c | ||
| 520 | + ] = a.onmouseout = a.onmouseover = a.ontouchstart = a.onclick = null; | ||
| 521 | + C(a); | ||
| 522 | + }), | ||
| 523 | + (e.length = 0)); | ||
| 524 | + c && | ||
| 525 | + (l(c, function(a) { | ||
| 526 | + a(); | ||
| 527 | + }), | ||
| 528 | + (c.length = 0)); | ||
| 529 | + } | ||
| 530 | + }); | ||
| 531 | + J.menu = function(a, b, e, c) { | ||
| 532 | + return [ | ||
| 533 | + "M", | ||
| 534 | + a, | ||
| 535 | + b + 2.5, | ||
| 536 | + "L", | ||
| 537 | + a + e, | ||
| 538 | + b + 2.5, | ||
| 539 | + "M", | ||
| 540 | + a, | ||
| 541 | + b + c / 2 + 0.5, | ||
| 542 | + "L", | ||
| 543 | + a + e, | ||
| 544 | + b + c / 2 + 0.5, | ||
| 545 | + "M", | ||
| 546 | + a, | ||
| 547 | + b + c - 1.5, | ||
| 548 | + "L", | ||
| 549 | + a + e, | ||
| 550 | + b + c - 1.5 | ||
| 551 | + ]; | ||
| 552 | + }; | ||
| 553 | + z.prototype.renderExporting = function() { | ||
| 554 | + var a = this, | ||
| 555 | + b = a.options.exporting, | ||
| 556 | + e = b.buttons, | ||
| 557 | + c = a.isDirtyExporting || !a.exportSVGElements; | ||
| 558 | + a.buttonOffset = 0; | ||
| 559 | + a.isDirtyExporting && a.destroyExport(); | ||
| 560 | + c && | ||
| 561 | + !1 !== b.enabled && | ||
| 562 | + ((a.exportEvents = []), | ||
| 563 | + (a.exportingGroup = | ||
| 564 | + a.exportingGroup || | ||
| 565 | + a.renderer | ||
| 566 | + .g("exporting-group") | ||
| 567 | + .attr({ zIndex: 3 }) | ||
| 568 | + .add()), | ||
| 569 | + E(e, function(b) { | ||
| 570 | + a.addButton(b); | ||
| 571 | + }), | ||
| 572 | + (a.isDirtyExporting = !1)); | ||
| 573 | + q(a, "destroy", a.destroyExport); | ||
| 574 | + }; | ||
| 575 | + q(z, "init", function() { | ||
| 576 | + var a = this; | ||
| 577 | + l(["exporting", "navigation"], function(b) { | ||
| 578 | + a[b] = { | ||
| 579 | + update: function(e, c) { | ||
| 580 | + a.isDirtyExporting = !0; | ||
| 581 | + p(!0, a.options[b], e); | ||
| 582 | + A(c, !0) && a.redraw(); | ||
| 583 | + } | ||
| 584 | + }; | ||
| 585 | + }); | ||
| 586 | + }); | ||
| 587 | + z.prototype.callbacks.push(function(a) { | ||
| 588 | + a.renderExporting(); | ||
| 589 | + q(a, "redraw", a.renderExporting); | ||
| 590 | + }); | ||
| 591 | + })(g); | ||
| 592 | +}); | ||
| 29 | //# sourceMappingURL=exporting.js.map | 593 | //# sourceMappingURL=exporting.js.map | ... | ... |
| 1 | -<!DOCTYPE HTML> | 1 | +<!DOCTYPE html> |
| 2 | <html> | 2 | <html> |
| 3 | - <head> | 3 | + <head> |
| 4 | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 4 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 | - <meta name="viewport" content="width=device-width, initial-scale=1"> | 5 | + <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 6 | - <title>Highcharts Example</title> | 6 | + <title>Highcharts Example</title> |
| 7 | 7 | ||
| 8 | - <style type="text/css"> | 8 | + <style type="text/css"></style> |
| 9 | + </head> | ||
| 10 | + <body> | ||
| 11 | + <script src="../../code/highcharts.js"></script> | ||
| 12 | + <script src="../../code/modules/exporting.js"></script> | ||
| 13 | + <script src="../../code/modules/export-data.js"></script> | ||
| 9 | 14 | ||
| 10 | - </style> | 15 | + <div |
| 11 | - </head> | 16 | + id="container" |
| 12 | - <body> | 17 | + style="min-width: 310px; height: 400px; margin: 0 auto" |
| 13 | -<script src="../../code/highcharts.js"></script> | 18 | + ></div> |
| 14 | -<script src="../../code/modules/exporting.js"></script> | ||
| 15 | -<script src="../../code/modules/export-data.js"></script> | ||
| 16 | 19 | ||
| 17 | -<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> | 20 | + <script type="text/javascript"> |
| 21 | + var death = [3, 4, 3, 5, 4, 10, 12]; | ||
| 22 | + var temp = [1, 3, 10, 3, 11, 5, 8]; | ||
| 18 | 23 | ||
| 24 | + var chart = Highcharts.chart("container", { | ||
| 25 | + chart: { | ||
| 26 | + type: "areaspline" | ||
| 27 | + }, | ||
| 28 | + title: { | ||
| 29 | + text: "실시간 사망률" | ||
| 30 | + }, | ||
| 31 | + legend: { | ||
| 32 | + layout: "vertical", | ||
| 33 | + align: "left", | ||
| 34 | + verticalAlign: "top", | ||
| 35 | + x: 150, | ||
| 36 | + y: 100, | ||
| 37 | + floating: true, | ||
| 38 | + borderWidth: 1, | ||
| 39 | + backgroundColor: | ||
| 40 | + (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
| 41 | + "#FFFFFF" | ||
| 42 | + }, | ||
| 43 | + xAxis: { | ||
| 44 | + categories: [ | ||
| 45 | + "Monday", | ||
| 46 | + "Tuesday", | ||
| 47 | + "Wednesday", | ||
| 48 | + "Thursday", | ||
| 49 | + "Friday", | ||
| 50 | + "Saturday", | ||
| 51 | + "Sunday" | ||
| 52 | + ], | ||
| 53 | + plotBands: [ | ||
| 54 | + { | ||
| 55 | + // 색칠되는 구간 | ||
| 56 | + from: 4.5, | ||
| 57 | + to: 6.5, | ||
| 58 | + color: "rgba(68, 170, 213, .2)" | ||
| 59 | + } | ||
| 60 | + ] | ||
| 61 | + }, | ||
| 62 | + yAxis: { | ||
| 63 | + title: { | ||
| 64 | + text: "Fruit units" | ||
| 65 | + } | ||
| 66 | + }, | ||
| 67 | + tooltip: { | ||
| 68 | + shared: false, | ||
| 69 | + valueSuffix: " %", //point mouseover 단위 | ||
| 70 | + }, | ||
| 71 | + credits: { | ||
| 72 | + enabled: false | ||
| 73 | + }, | ||
| 74 | + plotOptions: { | ||
| 75 | + areaspline: { | ||
| 76 | + fillOpacity: 0.5 | ||
| 77 | + } | ||
| 78 | + }, | ||
| 79 | + series: [ | ||
| 80 | + { | ||
| 81 | + name: "사망률", | ||
| 82 | + data: [3, 4, 3, 5, 4, 10, 12] | ||
| 83 | + }, | ||
| 84 | + { | ||
| 85 | + name: "기온", | ||
| 86 | + data: [1, 3, 10, 3, 3, 5, 4] | ||
| 87 | + } | ||
| 88 | + ] | ||
| 89 | + }); | ||
| 19 | 90 | ||
| 91 | + death.push(11); | ||
| 92 | + temp.push(3); | ||
| 20 | 93 | ||
| 21 | - <script type="text/javascript"> | 94 | + chart.series[0].setData(death); |
| 95 | + chart.series[1].setData(temp); | ||
| 22 | 96 | ||
| 23 | -Highcharts.chart('container', { | 97 | + </script> |
| 24 | - chart: { | 98 | + </body> |
| 25 | - type: 'areaspline' | 99 | +</html> |
| 26 | - }, | ||
| 27 | - title: { | ||
| 28 | - text: '실시간 사망률' | ||
| 29 | - }, | ||
| 30 | - legend: { | ||
| 31 | - layout: 'vertical', | ||
| 32 | - align: 'left', | ||
| 33 | - verticalAlign: 'top', | ||
| 34 | - x: 150, | ||
| 35 | - y: 100, | ||
| 36 | - floating: true, | ||
| 37 | - borderWidth: 1, | ||
| 38 | - backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF' | ||
| 39 | - }, | ||
| 40 | - xAxis: { | ||
| 41 | - categories: [ | ||
| 42 | - 'Monday', | ||
| 43 | - 'Tuesday', | ||
| 44 | - 'Wednesday', | ||
| 45 | - 'Thursday', | ||
| 46 | - 'Friday', | ||
| 47 | - 'Saturday', | ||
| 48 | - 'Sunday' | ||
| 49 | - ], | ||
| 50 | - plotBands: [{ // visualize the weekend | ||
| 51 | - from: 4.5, | ||
| 52 | - to: 6.5, | ||
| 53 | - color: 'rgba(68, 170, 213, .2)' | ||
| 54 | - }] | ||
| 55 | - }, | ||
| 56 | - yAxis: { | ||
| 57 | - title: { | ||
| 58 | - text: 'Fruit units' | ||
| 59 | - } | ||
| 60 | - }, | ||
| 61 | - tooltip: { | ||
| 62 | - shared: true, | ||
| 63 | - valueSuffix: ' units' | ||
| 64 | - }, | ||
| 65 | - credits: { | ||
| 66 | - enabled: false | ||
| 67 | - }, | ||
| 68 | - plotOptions: { | ||
| 69 | - areaspline: { | ||
| 70 | - fillOpacity: 0.5 | ||
| 71 | - } | ||
| 72 | - }, | ||
| 73 | - series: [{ | ||
| 74 | - name: '사망률', | ||
| 75 | - data: [3, 4, 3, 5, 4, 10, 12] | ||
| 76 | - }, { | ||
| 77 | - name: '기온', | ||
| 78 | - data: [1, 3, 4, 3, 3, 5, 4] | ||
| 79 | - }] | ||
| 80 | -}); | ||
| 81 | - </script> | ||
| 82 | - </body> | ||
| 83 | -</html> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment