From fe6698e71e23bf9e053900f258c7f5983eafb0cd Mon Sep 17 00:00:00 2001 From: zhanghongqing Date: Tue, 13 Nov 2018 19:52:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E9=87=8F=E7=BB=9F=E8=AE=A1=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=BC=E5=87=BA=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 13 ++ .../dashboard/DashboardController.java | 96 ++++++++++++++ .../resources/messages/message_en.properties | 3 +- .../resources/messages/message_ru.properties | 7 +- .../messages/message_zh_CN.properties | 3 +- .../views/dashboard/dashBoardIndex.jsp | 1 + .../global/plugins/highcharts/js/exporting.js | 26 ++++ .../webapp/static/pages/scripts/echart.js | 121 +++++++++++++++++- 8 files changed, 264 insertions(+), 6 deletions(-) create mode 100644 src/main/webapp/static/global/plugins/highcharts/js/exporting.js diff --git a/pom.xml b/pom.xml index 25f43d168..ea3fda28f 100644 --- a/pom.xml +++ b/pom.xml @@ -700,5 +700,18 @@ + + + org.apache.xmlgraphics + batik-all + 1.10 + + + org.lucee + xml-apis-ext + 1.3.04 + + + diff --git a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java index d6b350fb8..989774028 100644 --- a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java +++ b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java @@ -1,15 +1,35 @@ package com.nis.web.controller.dashboard; +import java.awt.Color; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.StringReader; import java.lang.reflect.Type; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.batik.transcoder.SVGAbstractTranscoder; +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.image.ImageTranscoder; +import org.apache.batik.transcoder.image.JPEGTranscoder; +import org.apache.batik.transcoder.image.PNGTranscoder; +import org.jcodings.transcode.Transcoder; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; @@ -32,6 +52,8 @@ import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.configuration.WebsiteDomainTopic; import com.nis.util.CodeDicUtils; import com.nis.util.Constants; +import com.nis.util.DateUtil; +import com.nis.util.DateUtils; import com.nis.util.DictUtils; import com.nis.util.StringUtil; import com.nis.util.httpclient.HttpClientUtil; @@ -767,4 +789,78 @@ public class DashboardController extends BaseController{ System.out.println(map2.get("c")); } + /** + * HighCharts导出图片 + * @param response + * @param request + * @param page + * @throws ServletException, IOException + */ + @RequestMapping(value="saveAsImage") + public void toSaveAsImage(HttpServletResponse response,HttpServletRequest request) throws ServletException, IOException{ + request.setCharacterEncoding("utf-8"); //设置UTF-8编码,解决乱码问题 + String type = request.getParameter("type"); + String svg = request.getParameter("svg"); + String filename = request.getParameter("filename"); + filename = filename==null?"chart":filename; + ServletOutputStream out = response.getOutputStream(); + if (null != type && null != svg) { + svg = svg.replaceAll(":rect", "rect"); + String ext = ""; + PNGTranscoder t = null; + JPEGTranscoder t1=null; + if (type.equals("image/png")) { + ext = "png"; + t = new PNGTranscoder(); + t.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.black); + } else if (type.equals("image/jpeg")) { + ext = "jpg"; + t1 = new JPEGTranscoder(); + t1.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.black); + } /*else if (type.equals("application/pdf")) { + ext = "pdf"; + t = new PDFTranscoder(); + }*/ else if(type.equals("image/svg+xml")) + ext = "svg"; + String dateTime = DateUtils.getDateTime(); + response.addHeader("Content-Disposition", "attachment; filename="+ filename+"-"+dateTime + "."+ext); + response.addHeader("Content-Type", type); + + if (null != t) { + TranscoderInput input = new TranscoderInput(new StringReader(svg)); + TranscoderOutput output = new TranscoderOutput(out); + + try { + ((SVGAbstractTranscoder) t).transcode(input, output); + } catch (TranscoderException e) { + out.print("Problem transcoding stream. See the web logs for more details."); + e.printStackTrace(); + } + } else if (null != t1) { + TranscoderInput input = new TranscoderInput(new StringReader(svg)); + TranscoderOutput output = new TranscoderOutput(out); + + try { + ((SVGAbstractTranscoder) t1).transcode(input, output); + } catch (TranscoderException e) { + out.print("Problem transcoding stream. See the web logs for more details."); + e.printStackTrace(); + } + } else if (ext.equals("svg")) { + // out.print(svg); + OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); + writer.append(svg); + writer.close(); + } else + out.print("Invalid type: " + type); + } else { + response.addHeader("Content-Type", "text/html"); + out.println("Usage:\n\tParameter [svg]: The DOM Element to be converted." + + "\n\tParameter [type]: The destination MIME type for the elment to be transcoded."); + } + out.flush(); + out.close(); + } + + } diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 9837aefee..5183b0299 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1364,4 +1364,5 @@ inactive_time=Inactive Time max_cache_obj_size=Max Cache Object Size cache_time_error=Cache time can not exceed 24 hours(1440 minutes,86400 seconds). cache_size_error=Cache size can not exceed 1024TB(1048576GB,1073741824MB). -ignore_qs_error=Ignore query string has invisible character or comma \ No newline at end of file +ignore_qs_error=Ignore query string has invisible character or comma +NTC_DDOS_PROTECT_TARGET_IP=DDOS IP Configuration \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 0ec3e3f38..4d04086f2 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -550,7 +550,7 @@ port_mask=\u041C\u0430\u0441\u043A\u0430 \u041F\u043E\u0440\u0442\u0430 ip_range=IP \u0414\u0438\u0430\u043F\u0430\u0437\u043E\u043D ip_subnet=\u041C\u0430\u0441\u043A\u0430 IP/\u041F\u043E\u0434\u0441\u0435\u0442\u0438 district=\u0420\u0430\u0439\u043E\u043D -\u0421\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f +\u0421\u043E\u0433\u043B\u0430\u0441\u043E\u0432\u0430\u043D\u0438\u044F keywords=\u041A\u043B\u044E\u0447\u0435\u0432\u044B\u0435 \u0421\u043B\u043E\u0432\u0430 http_ip_title=HTTP IP http_url_title=HTTP URL @@ -885,7 +885,7 @@ file_upload_error=\u041E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0433\u0440\ audio_sample_reject=\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u041C\u0443\u043B\u044C\u0442\u0438\u043C\u0435\u0434\u0438\u0439\u043D\u044B\u043C \u041E\u0431\u0440\u0430\u0437\u0446\u043E\u043C audio_sample_monit=\u041C\u043E\u043D\u0438\u0442\u043E\u0440\u0438\u043D\u0433 \u041C\u0443\u043B\u044C\u0442\u0438\u043C\u0435\u0434\u0438\u0439\u043D\u044B\u0445 \u041E\u0431\u0440\u0430\u0437\u0446\u043E\u0432 video_sample_reject=\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u041E\u0431\u0440\u0430\u0437\u0446\u043E\u043C - \u0412\u0438\u0434\u0435\u043e + \u0412\u0438\u0434\u0435\u043E video_sample_monit=\u041C\u043E\u043D\u0438\u0442\u043E\u0440\u0438\u043D\u0433 \u041E\u0431\u0440\u0430\u0437\u0446\u043E\u0432 \u0412\u0438\u0434\u0435\u043E pic_sample_reject=\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u041E\u0431\u0440\u0430\u0437\u0446\u043E\u043C \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F pic_sample_monit=\u041C\u043E\u043D\u0438\u0442\u043E\u0440\u0438\u043D\u0433 \u041E\u0431\u0440\u0430\u0437\u0446\u043E\u0432 \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F @@ -1354,4 +1354,5 @@ inactive_time=Inactive Time max_cache_obj_size=Max Cache Object Size cache_time_error=Cache time can not exceed 24 hours(1440 minutes,86400 seconds). cache_size_error=Cache size can not exceed 1024TB(1048576GB,1073741824MB). -ignore_qs_error=Ignore query string has invisible character or comma \ No newline at end of file +ignore_qs_error=Ignore query string has invisible character or comma +NTC_DDOS_PROTECT_TARGET_IP=\u041A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044F IP-\u0410\u0434\u0440\u0435\u0441\u0430 DDOS \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index b308e88c6..74d6ff21e 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1357,4 +1357,5 @@ inactive_time=\u672A\u88AB\u8BF7\u6C42\u7684\u6587\u4EF6\u65F6\u95F4 max_cache_obj_size=\u6700\u5927\u7F13\u5B58\u5BF9\u8C61\u5927\u5C0F cache_time_error=\u7F13\u5B58\u65F6\u95F4\u4E0D\u80FD\u8D85\u8FC7 24 \u5C0F\u65F6(1440\u5206\u949F,86400\u79D2). cache_size_error=\u7F13\u5B58\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC71024TB(1048576GB,1073741824MB). -ignore_qs_error=\u5FFD\u7565\u7684\u67E5\u8BE2\u53C2\u6570\u4E2D\u5305\u542B\u4E0D\u53EF\u89C1\u5B57\u7B26\u6216\u8005\u9017\u53F7 \ No newline at end of file +ignore_qs_error=\u5FFD\u7565\u7684\u67E5\u8BE2\u53C2\u6570\u4E2D\u5305\u542B\u4E0D\u53EF\u89C1\u5B57\u7B26\u6216\u8005\u9017\u53F7 +NTC_DDOS_PROTECT_TARGET_IP=\u76EE\u6807\u9632\u62A4IP\u914D\u7F6E \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp index 789f0df25..1aa753886 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp @@ -373,6 +373,7 @@ + <%-- --%> diff --git a/src/main/webapp/static/global/plugins/highcharts/js/exporting.js b/src/main/webapp/static/global/plugins/highcharts/js/exporting.js new file mode 100644 index 000000000..5625f1143 --- /dev/null +++ b/src/main/webapp/static/global/plugins/highcharts/js/exporting.js @@ -0,0 +1,26 @@ +/* + Highcharts JS v6.1.0 (2018-04-13) + Exporting module + + (c) 2010-2017 Torstein Honsi + + License: www.highcharts.com/license +*/ +(function(h){"object"===typeof module&&module.exports?module.exports=h:h(Highcharts)})(function(h){(function(f){var h=f.defaultOptions,z=f.doc,A=f.Chart,w=f.addEvent,H=f.removeEvent,D=f.fireEvent,q=f.createElement,B=f.discardElement,u=f.css,p=f.merge,r=f.pick,k=f.each,E=f.objectEach,t=f.extend,I=f.isTouchDevice,C=f.win,F=C.navigator.userAgent,J=f.Renderer.prototype.symbols;/Edge\/|Trident\/|MSIE /.test(F);/firefox/i.test(F);t(h.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"});h.navigation={buttonOptions:{theme:{},symbolSize:14,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,verticalAlign:"top",width:24}};p(!0,h.navigation,{menuStyle:{border:"1px solid #999999",background:"#ffffff",padding:"5px 0"},menuItemStyle:{padding:"0.5em 1em",background:"none",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}}});h.exporting={type:"image/png",url:"${pageContext.request.contextPath}/",printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton",menuClassName:"highcharts-contextmenu",symbol:"menu",_titleKey:"contextButtonTitle",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",onclick:function(){this.exportChart({type:"image/svg+xml"})}}}};f.post=function(a,b,e){var c=q("form",p({method:"post",action:a,enctype:"multipart/form-data"}, +e),{display:"none"},z.body);E(b,function(a,b){q("input",{type:"hidden",name:b,value:a},null,c)});c.submit();B(c)};t(A.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'+e[1]+"\x3c/body\x3e\x3c/foreignObject\x3e",a=a.replace("\x3c/svg\x3e",e+"\x3c/svg\x3e"))}a=a.replace(/zIndex="[^"]+"/g, +"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|")(\S+)("|")\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/.*?$/,"\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");this.ieSanitizeSVG&&(a=this.ieSanitizeSVG(a));return a},getChartHTML:function(){return this.container.innerHTML},getSVG:function(a){var b,e,c,v,m,g=p(this.options,a);e=q("div",null,{position:"absolute",top:"-9999em",width:this.chartWidth+"px",height:this.chartHeight+"px"},z.body);c=this.renderTo.style.width;m=this.renderTo.style.height;c=g.exporting.sourceWidth||g.chart.width||/px$/.test(c)&&parseInt(c,10)||600;m=g.exporting.sourceHeight||g.chart.height||/px$/.test(m)&& +parseInt(m,10)||400;t(g.chart,{animation:!1,renderTo:e,forExport:!0,renderer:"SVGRenderer",width:c,height:m});g.exporting.enabled=!1;delete g.data;g.series=[];k(this.series,function(a){v=p(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});v.isInternal||g.series.push(v)});k(this.axes,function(a){a.userOptions.internalKey||(a.userOptions.internalKey=f.uniqueKey())});b=new f.Chart(g,this.callback);a&&k(["xAxis","yAxis","series"],function(c){var d={};a[c]&&(d[c]=a[c], +b.update(d))});k(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&&void 0===d||c.setExtremes(e,d,!0,!1)});c=b.getChartHTML();c=this.sanitizeSVG(c,g);g=null;b.destroy();B(e);return c},getSVGForExport:function(a,b){var e=this.options.exporting;return this.getSVG(p({chart:{borderRadius:0}},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=z.body,m=f.childNodes,g=a.options.exporting.printMaxWidth,d,n;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null,0);D(a,"beforePrint");if(n=g&&a.chartWidth>g)d=[a.options.chart.width,void 0,!1],a.setSize(g,void 0,!1); +k(m,function(a,b){1===a.nodeType&&(e[b]=a.style.display,a.style.display="none")});f.appendChild(b);C.focus();C.print();setTimeout(function(){c.appendChild(b);k(m,function(a,b){1===a.nodeType&&(a.style.display=e[b])});a.isPrinting=!1;n&&a.setSize.apply(a,d);D(a,"afterPrint")},1E3)}},contextMenu:function(a,b,e,c,v,m,g){var d=this,n=d.options.navigation,h=d.chartWidth,G=d.chartHeight,p="cache-"+a,l=d[p],x=Math.max(v,m),y,r;l||(d[p]=l=q("div",{className:a},{position:"absolute",zIndex:1E3,padding:x+"px"}, +d.container),y=q("div",{className:"highcharts-menu"},null,l),u(y,t({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},n.menuStyle)),r=function(){u(l,{display:"none"});g&&g.setState(0);d.openMenu=!1},d.exportEvents.push(w(l,"mouseleave",function(){l.hideTimer=setTimeout(r,500)}),w(l,"mouseenter",function(){f.clearTimeout(l.hideTimer)}),w(z,"mouseup",function(b){d.pointer.inClass(b.target,a)||r()})),k(b,function(a){"string"===typeof a&&(a=d.options.exporting.menuItemDefinitions[a]); +if(f.isObject(a,!0)){var b;a.separator?b=q("hr",null,null,y):(b=q("div",{className:"highcharts-menu-item",onclick:function(b){b&&b.stopPropagation();r();a.onclick&&a.onclick.apply(d,arguments)},innerHTML:a.text||d.options.lang[a.textKey]},null,y),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(y,l),d.exportMenuWidth=l.offsetWidth,d.exportMenuHeight= +l.offsetHeight);b={display:"block"};e+d.exportMenuWidth>h?b.right=h-e-v-x+"px":b.left=e-x+"px";c+m+d.exportMenuHeight>G&&"top"!==g.alignOptions.verticalAlign?b.bottom=G-c-x+"px":b.top=c+m-x+"px";u(l,b);d.openMenu=!0},addButton:function(a){var b=this,e=b.renderer,c=p(b.options.navigation.buttonOptions,a),f=c.onclick,m=c.menuItems,g,d,n=c.symbolSize||12;b.btnCount||(b.btnCount=0);b.exportDivElements||(b.exportDivElements=[],b.exportSVGElements=[]);if(!1!==c.enabled){var h=c.theme,k=h.states,q=k&&k.hover, +k=k&&k.select,l;delete h.states;f?l=function(a){a.stopPropagation();f.call(b,a)}:m&&(l=function(){b.contextMenu(d.menuClassName,m,d.translateX,d.translateY,d.width,d.height,d);d.setState(2)});c.text&&c.symbol?h.paddingLeft=r(h.paddingLeft,25):c.text||t(h,{width:c.width,height:c.height,padding:0});d=e.button(c.text,0,0,l,h,q,k).addClass(a.className).attr({"stroke-linecap":"round",title:r(b.options.lang[c._titleKey],""),zIndex:3});d.menuClassName=a.menuClassName||"highcharts-menu-"+b.btnCount++;c.symbol&& +(g=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),g.attr({stroke:c.symbolStroke,fill:c.symbolFill,"stroke-width":c.symbolStrokeWidth||1}));d.add().align(t(c,{width:d.width,x:r(c.x,b.buttonOffset)}),!0,"spacingBox");b.buttonOffset+=(d.width+c.buttonSpacing)*("right"===c.align?-1:1);b.exportSVGElements.push(d,g)}},destroyExport:function(a){var b=a?a.target:this;a=b.exportSVGElements;var e=b.exportDivElements,c=b.exportEvents, +h;a&&(k(a,function(a,c){a&&(a.onclick=a.ontouchstart=null,h="cache-"+a.menuClassName,b[h]&&delete b[h],b.exportSVGElements[c]=a.destroy())}),a.length=0);e&&(k(e,function(a,c){f.clearTimeout(a.hideTimer);H(a,"mouseleave");b.exportDivElements[c]=a.onmouseout=a.onmouseover=a.ontouchstart=a.onclick=null;B(a)}),e.length=0);c&&(k(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]};A.prototype.renderExporting= +function(){var a=this,b=a.options.exporting,e=b.buttons,c=a.isDirtyExporting||!a.exportSVGElements;a.buttonOffset=0;a.isDirtyExporting&&a.destroyExport();c&&!1!==b.enabled&&(a.exportEvents=[],E(e,function(b){a.addButton(b)}),a.isDirtyExporting=!1);w(a,"destroy",a.destroyExport)};A.prototype.callbacks.push(function(a){a.renderExporting();w(a,"redraw",a.renderExporting);k(["exporting","navigation"],function(b){a[b]={update:function(e,c){a.isDirtyExporting=!0;p(!0,a.options[b],e);r(c,!0)&&a.redraw()}}})})})(h)}); diff --git a/src/main/webapp/static/pages/scripts/echart.js b/src/main/webapp/static/pages/scripts/echart.js index d1adc1e08..bc9861d6c 100644 --- a/src/main/webapp/static/pages/scripts/echart.js +++ b/src/main/webapp/static/pages/scripts/echart.js @@ -39,6 +39,21 @@ // margin:10, }, + exporting: { + allowHTML:true, + url:'saveAsImage', + filename:'Protocol-Type', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, noData:{ style: {//设置字体颜色 color: '#fff', @@ -203,6 +218,21 @@ marginTop:50, inverted: true, }, + exporting: { + allowHTML:true, + url:'saveAsImage', + filename:'Active-IP', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, noData:{ style: {//设置字体颜色 color: '#fff', @@ -346,6 +376,21 @@ marginBottom:60, }, + exporting: { + allowHTML:true, + url:'saveAsImage', + filename:'App', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, noData:{ style: {//设置字体颜色 color: '#fff', @@ -485,6 +530,21 @@ function echart_2(rs){ plotShadow:false, type: 'pie' }, + exporting: { + allowHTML:true, + url:'saveAsImage', + filename:'BS', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, noData:{ style: {//设置字体颜色 color: '#fff', @@ -609,6 +669,21 @@ function echart_5(rs){ plotShadow:false, type: 'pie' }, + exporting: { + allowHTML:true, + url:'saveAsImage', + filename:'BS', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, legend:{ width:480, x:40, @@ -734,7 +809,21 @@ function echart_4(rs){ plotShadow:false, type: 'pie' }, - + exporting: { + allowHTML:true, + url:'saveAsImage', + filename:'Website', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, colors:[ '#44A9A8', '#f36f8a','#25f3e6','#ffff43','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'], title: { text: null, @@ -853,6 +942,21 @@ function echart_6(rs){ plotShadow:false, type: 'pie' }, + exporting: { + allowHTML:true, + url:'saveAsImage', + filename:'Website', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, noData:{ style: {//设置字体颜色 color: '#fff', @@ -976,6 +1080,21 @@ function echart_topic_domain(rs){ marginTop:50, marginBottom:10, }, + exporting: { + allowHTML:true, + url:'saveAsImage', + filename:'Topic', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, colors:[ '#44A9A8', '#f36f8a','#25f3e6','#ffff43','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6','#0099cc','#cc0033','#ff6633','#99cccc','#d9f9d0'], noData:{ style: {//设置字体颜色