96b9f3f2295f6ae71247bba0533fb194bb10bde5.svn-base 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. //定义一组颜色值,可获取相应的样式
  2. var HistohramChartsColor=["#1685a9","#177cb0","#065279","#003472","#4b5cc4","#a1afc9","#2e4e7e",
  3. "#3b2e7e","#4a4266","#426666","#425066","#574266","#8d4bbb","#815463",
  4. "#815476","#4c221b","#003371","#56004f","#801dae","#4c8dae","#b0a4e3"];
  5. /*var HistohramChartsColor=["#383a37","#424647","#4a4041","#3f3534","#3c434b","#626971","#a5aaae",
  6. "#46af91","#ffc631","#ff6742","#ed2b6a","#cd13a5","#735cc6","#b5e4c4",
  7. "#78ce83","#57c27a","#47b657","#3da159","#3e5d3d","#2f573f","#99b9e2"];
  8. var HistohramChartsColor=["#99CC33","#336699","#333300","#3366CC","#99CC33","#333300","#003366",
  9. "#999933","#FF9933","#996600","#993366","#663366","#CCCC33","#CC3366",
  10. "#663366","#996699","#CC9999","#006633","#006633","#669933","#669933"];
  11. var HistohramChartsColor=["#CCCC33","#CC6699","#CC9933","#CC6600","#CC6600","#CC6600","#339999",
  12. "#CC6699","#CC6699","#FF6666","#FF99CC","#CC3399","#FF99CC","#CC3399",
  13. "#CC3399","#FF9999","#996699","#FF33CC","#FF6666","#CC6699","#990066"];*/
  14. //仪表盘中最大修编数
  15. var chageMax=50;
  16. //仪表盘中修编的数量
  17. var gauhevalue=1;
  18. //鼠标单击或去到名称
  19. var clickName="总体预案";
  20. //得到当前单位
  21. var Unit="广东电网公司";//(彭志超)
  22. var UnitName=Unit+"应急预案修编统计";
  23. //系列
  24. var legendHistohramCharts = ["事故灾难", "自然灾害", "社会安全事件", "公共安全事件", "总体预案","部门预案","现场处置方案"];//(彭志超)
  25. //分类
  26. var HistohramUnit=["总体预案","专项预案","部门预案","现场处置方案"];
  27. //参数
  28. var HistohramPram= [//(彭志超)
  29. {
  30. name: "总体预案",
  31. type: "bar",
  32. stack: "总体预案",
  33. itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
  34. data: [13,'','',''],
  35. barMaxWidth:60
  36. },
  37. {
  38. name: "事故灾难",
  39. type: "bar",
  40. stack: "专项预案",
  41. itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
  42. data: ['',3,'',''],
  43. barMaxWidth:60
  44. },
  45. {
  46. name: "自然灾害",
  47. type: "bar",
  48. stack: "专项预案",
  49. itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
  50. data: ['null',4,'null','null'],
  51. barMaxWidth:60
  52. },
  53. {
  54. name: "社会安全事件",
  55. type: "bar",
  56. stack: "专项预案",
  57. itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
  58. data: ['',7,'',''],
  59. barMaxWidth:60
  60. },
  61. {
  62. name: "公共安全事件",
  63. type: "bar",
  64. stack: "专项预案",
  65. itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
  66. data: ['',6,'',''],
  67. barMaxWidth:60
  68. },
  69. {
  70. name: "部门预案",
  71. type: "bar",
  72. stack: "部门预案",
  73. itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
  74. data: ['','',13,''],
  75. barMaxWidth:60
  76. },
  77. {
  78. name: "现场处置方案",
  79. type: "bar",
  80. stack: "现场处置方案",
  81. itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
  82. data: ['','','',11],
  83. barMaxWidth:60
  84. }
  85. ];
  86. // Step:3 conifg ECharts's path, link to echarts.js from current page.
  87. // Step:3 为模块加载器配置echarts的路径,从当前页面链接到echarts.js,定义所需图表路径
  88. /**
  89. * @author jiangyongfei
  90. * @param 获取地图中所有显示的json
  91. */
  92. function getChildInfo(){
  93. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getAllSum/';
  94. var params = {
  95. deptId : comp_id
  96. };
  97. $.ajax({
  98. url : url,
  99. type : 'post',
  100. timeout : 60000,
  101. data : params,
  102. dataType : 'JSON',
  103. success : function(data){
  104. JSON.stringify(data);
  105. //图例
  106. legendHistohramCharts=JSON.stringify(data.legendHistohramCharts);
  107. //单位
  108. HistohramUnit=JSON.stringify(data.HistohramUnit);
  109. //参数
  110. HistohramPram=JSON.stringify(data.HistohramPram);
  111. for(var i=0;i<5;i++)
  112. {
  113. HistohramPram=HistohramPram.replace("\"{normal: {label:{show: true, position: insideRight}}}\"", "{normal: {label:{show: true, position: \"insideRight\"}}}");
  114. }
  115. HistohramPram=eval('('+ HistohramPram+')');
  116. },
  117. error : function(e){
  118. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  119. }
  120. });
  121. }
  122. function emergencyCommandAndRegulatoryAgency439()
  123. {
  124. require.config({
  125. paths: {
  126. echarts: '/nwyj/page/cockpit/tableandmap/js'
  127. }
  128. });
  129. // Step:4 require echarts and use it in the callback.
  130. // Step:4 动态加载echarts然后在回调函数中开始使用,注意保持按需加载结构定义图表路径
  131. require(
  132. [
  133. 'echarts',
  134. 'echarts/chart/bar',
  135. 'echarts/chart/line',
  136. 'echarts/chart/pie',
  137. 'echarts/chart/map',
  138. 'echarts/chart/funnel',
  139. 'echarts/chart/gauge'
  140. ],
  141. function (ec)
  142. {
  143. optionpie = {
  144. tooltip : {
  145. //formatter: "{a} <br/>{b} : {c}%"
  146. },
  147. toolbox: {
  148. show: true,
  149. feature: {
  150. mark: {
  151. show: false
  152. },
  153. dataView: {
  154. show: false,
  155. readOnly: true
  156. },
  157. magicType: {
  158. show: false,
  159. type: ["line", "bar", "stack", "tiled"]
  160. },
  161. restore: {
  162. show: false
  163. },
  164. saveAsImage: {
  165. show: true
  166. },
  167. dataZoom: {
  168. show: false
  169. }
  170. }
  171. },
  172. series : [
  173. {
  174. name:clickName,
  175. type:'gauge',
  176. min:0,
  177. max:chageMax,
  178. detail : {formatter:'{value}'},
  179. data:[{value: gauhevalue, name: '修编'}]
  180. }
  181. ]
  182. };
  183. option = {
  184. title : {
  185. text:UnitName,
  186. x:'center',
  187. y:"0"
  188. },
  189. tooltip: {
  190. trigger: "item",
  191. axisPointer: {
  192. type: "shadow"
  193. },
  194. show: true,
  195. islandFormatter: "{a} <br>{b} : {c}",
  196. textStyle: {
  197. align: "center",
  198. baseline: "middle"
  199. }
  200. },
  201. legend: {
  202. data:legendHistohramCharts,
  203. selectedMode: "multiple",
  204. x: "center",
  205. y: "30",
  206. orient: "horizontal"
  207. },
  208. toolbox: {
  209. show: true,
  210. feature: {
  211. mark: {
  212. show: false
  213. },
  214. dataView: {
  215. show: false,
  216. readOnly: true
  217. },
  218. magicType: {
  219. show: false,
  220. type: ["line", "bar", "stack", "tiled"]
  221. },
  222. restore: {
  223. show: false
  224. },
  225. saveAsImage: {
  226. show: true
  227. },
  228. dataZoom: {
  229. show: false
  230. }
  231. }
  232. },
  233. calculable: true,
  234. xAxis: [
  235. {
  236. type: "category",
  237. data:HistohramUnit
  238. }
  239. ],
  240. yAxis: [
  241. {
  242. type: "value"
  243. }
  244. ],
  245. series:HistohramPram,
  246. backgroundColor: "rgb(255, 255, 255)",
  247. color:HistohramChartsColor
  248. };
  249. var myChart = ec.init(document.getElementById('histogram'));
  250. myChart.setOption(option);
  251. var myChart2 = ec.init(document.getElementById('pie'));
  252. myChart2.setOption(optionpie);
  253. window.onresize = myChart.resize;
  254. //添加点击事件
  255. var ecConfig = require('echarts/config');
  256. function eConsole(param)
  257. {
  258. //如果点击获得的数据不为空,重新加载仪表盘
  259. if (clickName != undefined) {
  260. var myChart3 = ec.init(document.getElementById('pie'));
  261. optionpie["series"][0]["name"] = param.seriesName;
  262. //总数
  263. optionpie["series"][0]["max"] = param.value;
  264. //修编数
  265. optionpie["series"][0]["data"][0]["value"] = gauhevalue+1;
  266. optionpie["series"][0]["data"][0]["name"] = "修编数量";
  267. myChart3.setOption(optionpie);
  268. }
  269. if (param.type == 'hover') {
  270. document.getElementById('hover-console').innerHTML = 'Event Console : ' + mes;
  271. }
  272. else {
  273. document.getElementById('console').innerHTML = mes;
  274. }
  275. console.log(param);
  276. }
  277. myChart.on(ecConfig.EVENT.CLICK, eConsole);
  278. //myChart.on(ecConfig.EVENT.DBLCLICK, eConsole);
  279. //myChart.on(ecConfig.EVENT.HOVER, eConsole);
  280. //myChart.on(ecConfig.EVENT.DATA_ZOOM, eConsole);
  281. //myChart.on(ecConfig.EVENT.LEGEND_SELECTED, eConsole);
  282. //myChart.on(ecConfig.EVENT.MAGIC_TYPE_CHANGED, eConsole);
  283. //myChart.on(ecConfig.EVENT.DATA_VIEW_CHANGED, eConsole);
  284. });
  285. }