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 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
| <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <!DOCTYPE html> <head> <meta charset="utf-8"> <title>ECharts</title> <style type="text/css"> #summary { font-family: "微软雅黑"; padding-left:80px; padding-top:30px; padding-bottom:50px; } #summary ul li{ margin: 10px; } #main{ padding-top:50px } </style> </head> <body> <div id="main" style="width: 95%; height: 80%"></div> <div id="summary"> <h3>支付统计情况</h3> <ul> <li><h4>总金额(元):${sum }</h4></li> <c:forEach items="${channelValMap }" var="pay"> <li><span class="channel">${pay.key }</span>: <span>${pay.value }</span></li> </c:forEach> </ul> </div> <script type="text/javascript"> $('span[class=channel]').each(function() { $(this).html(replaceChannelName($(this).html())); }); function replaceChannelName(name) { if (name == 'ios-haima') { name = '海马玩(iOS)'; } else if (name == 'android-haima') { name = '海马玩(安卓)'; } else if (name == 'android-xiaomi') { name = '小米(安卓)'; } else if (name == 'ios-xy') { name = 'xy(iOS)'; } else if (name == 'ios-kuaiyong') { name = '快用(iOS)'; } else if (name == 'android-360') { name = '360(安卓)'; } return name; } $ .ajax({ type : "GET", dataType : "text", url : "../paymgr/payChartHandle", success : function(data) { var ret = JSON.parse(data); for ( var tmp in ret.channelCharts) { ret.channelCharts[tmp] = replaceChannelName(ret.channelCharts[tmp]); } for ( var tmp in ret.payChartDatas) { ret.payChartDatas[tmp].name = replaceChannelName(ret.payChartDatas[tmp].name); } require.config({ paths : { echarts : 'http://echarts.baidu.com/build/dist' } }); require( [ 'echarts', 'echarts/chart/bar', 'echarts/chart/line', 'echarts/component/dataZoom' ], function(ec) { var myChart = ec.init(document .getElementById('main')); var option = { tooltip : { trigger : 'item' }, toolbox : { show : true, feature : { mark : { show : true }, dataView : { show : true, readOnly : false }, dataZoom : { show : true, }, magicType : { show : true, type : [ 'line', 'bar', 'stack', 'tiled' ] }, restore : { show : true }, saveAsImage : { show : true } } }, calculable : true, grid : { top : '12%', left : '1%', right : '10%', containLabel : true }, legend : { data : ret.channelCharts }, xAxis : [ { name : '支付日期', type : 'category', data : ret.dateCharts } ], yAxis : [ { name : '金额(元)', type : 'value' } ], dataZoom : { type : 'inside', show : true, realtime : true, y : 36, height : 20, backgroundColor : 'rgba(221,160,221,0.5)', dataBackgroundColor : 'rgba(138,43,226,0.5)', fillerColor : 'rgba(38,143,26,0.6)', handleColor : 'rgba(128,43,16,0.8)', start : 20, end : 80 }, series : ret.payChartDatas }; myChart.setOption(option); }); }, }); </script> </body>
|