123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- //定义一组颜色值,可获取相应的样式
- var HistohramChartsColor=["#1685a9","#177cb0","#065279","#003472","#4b5cc4","#a1afc9","#2e4e7e",
- "#3b2e7e","#4a4266","#426666","#425066","#574266","#8d4bbb","#815463",
- "#815476","#4c221b","#003371","#56004f","#801dae","#4c8dae","#b0a4e3"];
- /*var HistohramChartsColor=["#383a37","#424647","#4a4041","#3f3534","#3c434b","#626971","#a5aaae",
- "#46af91","#ffc631","#ff6742","#ed2b6a","#cd13a5","#735cc6","#b5e4c4",
- "#78ce83","#57c27a","#47b657","#3da159","#3e5d3d","#2f573f","#99b9e2"];
- var HistohramChartsColor=["#99CC33","#336699","#333300","#3366CC","#99CC33","#333300","#003366",
- "#999933","#FF9933","#996600","#993366","#663366","#CCCC33","#CC3366",
- "#663366","#996699","#CC9999","#006633","#006633","#669933","#669933"];
- var HistohramChartsColor=["#CCCC33","#CC6699","#CC9933","#CC6600","#CC6600","#CC6600","#339999",
- "#CC6699","#CC6699","#FF6666","#FF99CC","#CC3399","#FF99CC","#CC3399",
- "#CC3399","#FF9999","#996699","#FF33CC","#FF6666","#CC6699","#990066"];*/
- //仪表盘中最大修编数
- var chageMax=50;
- //仪表盘中修编的数量
- var gauhevalue=1;
- //鼠标单击或去到名称
- var clickName="总体预案";
- //得到当前单位
- var Unit="广东电网公司";//(彭志超)
- var UnitName=Unit+"应急预案修编统计";
- //系列
- var legendHistohramCharts = ["事故灾难", "自然灾害", "社会安全事件", "公共安全事件", "总体预案","部门预案","现场处置方案"];//(彭志超)
- //分类
- var HistohramUnit=["总体预案","专项预案","部门预案","现场处置方案"];
- //参数
- var HistohramPram= [//(彭志超)
- {
- name: "总体预案",
- type: "bar",
- stack: "总体预案",
- itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
- data: [13,'','',''],
- barMaxWidth:60
- },
- {
- name: "事故灾难",
- type: "bar",
- stack: "专项预案",
- itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
- data: ['',3,'',''],
- barMaxWidth:60
- },
- {
- name: "自然灾害",
- type: "bar",
- stack: "专项预案",
- itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
- data: ['null',4,'null','null'],
- barMaxWidth:60
- },
- {
- name: "社会安全事件",
- type: "bar",
- stack: "专项预案",
- itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
- data: ['',7,'',''],
- barMaxWidth:60
- },
- {
- name: "公共安全事件",
- type: "bar",
- stack: "专项预案",
- itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
- data: ['',6,'',''],
- barMaxWidth:60
- },
- {
- name: "部门预案",
- type: "bar",
- stack: "部门预案",
- itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
- data: ['','',13,''],
- barMaxWidth:60
- },
- {
- name: "现场处置方案",
- type: "bar",
- stack: "现场处置方案",
- itemStyle: {normal: {label: {show: true,position: "insideRight"}}},
- data: ['','','',11],
- barMaxWidth:60
- }
- ];
- // Step:3 conifg ECharts's path, link to echarts.js from current page.
- // Step:3 为模块加载器配置echarts的路径,从当前页面链接到echarts.js,定义所需图表路径
- /**
- * @author jiangyongfei
- * @param 获取地图中所有显示的json
- */
- function getChildInfo(){
- var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getAllSum/';
- var params = {
- deptId : comp_id
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'JSON',
- success : function(data){
- JSON.stringify(data);
- //图例
- legendHistohramCharts=JSON.stringify(data.legendHistohramCharts);
- //单位
- HistohramUnit=JSON.stringify(data.HistohramUnit);
- //参数
- HistohramPram=JSON.stringify(data.HistohramPram);
- for(var i=0;i<5;i++)
- {
- HistohramPram=HistohramPram.replace("\"{normal: {label:{show: true, position: insideRight}}}\"", "{normal: {label:{show: true, position: \"insideRight\"}}}");
- }
- HistohramPram=eval('('+ HistohramPram+')');
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
- function emergencyCommandAndRegulatoryAgency439()
- {
- require.config({
- paths: {
- echarts: '/nwyj/page/cockpit/tableandmap/js'
- }
- });
- // Step:4 require echarts and use it in the callback.
- // Step:4 动态加载echarts然后在回调函数中开始使用,注意保持按需加载结构定义图表路径
- require(
- [
- 'echarts',
- 'echarts/chart/bar',
- 'echarts/chart/line',
- 'echarts/chart/pie',
- 'echarts/chart/map',
- 'echarts/chart/funnel',
- 'echarts/chart/gauge'
- ],
- function (ec)
- {
- optionpie = {
- tooltip : {
- //formatter: "{a} <br/>{b} : {c}%"
- },
- toolbox: {
- show: true,
- feature: {
- mark: {
- show: false
- },
- dataView: {
- show: false,
- readOnly: true
- },
- magicType: {
- show: false,
- type: ["line", "bar", "stack", "tiled"]
- },
- restore: {
- show: false
- },
- saveAsImage: {
- show: true
- },
- dataZoom: {
- show: false
- }
- }
- },
- series : [
- {
- name:clickName,
- type:'gauge',
- min:0,
- max:chageMax,
- detail : {formatter:'{value}'},
- data:[{value: gauhevalue, name: '修编'}]
- }
- ]
- };
-
-
-
-
- option = {
- title : {
- text:UnitName,
- x:'center',
- y:"0"
- },
- tooltip: {
- trigger: "item",
- axisPointer: {
- type: "shadow"
- },
- show: true,
- islandFormatter: "{a} <br>{b} : {c}",
- textStyle: {
- align: "center",
- baseline: "middle"
- }
- },
- legend: {
- data:legendHistohramCharts,
- selectedMode: "multiple",
- x: "center",
- y: "30",
- orient: "horizontal"
- },
- toolbox: {
- show: true,
- feature: {
- mark: {
- show: false
- },
- dataView: {
- show: false,
- readOnly: true
- },
- magicType: {
- show: false,
- type: ["line", "bar", "stack", "tiled"]
- },
- restore: {
- show: false
- },
- saveAsImage: {
- show: true
- },
- dataZoom: {
- show: false
- }
- }
- },
- calculable: true,
- xAxis: [
- {
- type: "category",
- data:HistohramUnit
- }
- ],
- yAxis: [
- {
- type: "value"
- }
- ],
- series:HistohramPram,
- backgroundColor: "rgb(255, 255, 255)",
- color:HistohramChartsColor
- };
- var myChart = ec.init(document.getElementById('histogram'));
- myChart.setOption(option);
- var myChart2 = ec.init(document.getElementById('pie'));
- myChart2.setOption(optionpie);
- window.onresize = myChart.resize;
-
- //添加点击事件
- var ecConfig = require('echarts/config');
-
- function eConsole(param)
- {
- //如果点击获得的数据不为空,重新加载仪表盘
- if (clickName != undefined) {
- var myChart3 = ec.init(document.getElementById('pie'));
- optionpie["series"][0]["name"] = param.seriesName;
- //总数
- optionpie["series"][0]["max"] = param.value;
- //修编数
- optionpie["series"][0]["data"][0]["value"] = gauhevalue+1;
- optionpie["series"][0]["data"][0]["name"] = "修编数量";
- myChart3.setOption(optionpie);
- }
-
- if (param.type == 'hover') {
- document.getElementById('hover-console').innerHTML = 'Event Console : ' + mes;
- }
- else {
- document.getElementById('console').innerHTML = mes;
- }
- console.log(param);
- }
- myChart.on(ecConfig.EVENT.CLICK, eConsole);
- //myChart.on(ecConfig.EVENT.DBLCLICK, eConsole);
- //myChart.on(ecConfig.EVENT.HOVER, eConsole);
- //myChart.on(ecConfig.EVENT.DATA_ZOOM, eConsole);
- //myChart.on(ecConfig.EVENT.LEGEND_SELECTED, eConsole);
- //myChart.on(ecConfig.EVENT.MAGIC_TYPE_CHANGED, eConsole);
- //myChart.on(ecConfig.EVENT.DATA_VIEW_CHANGED, eConsole);
-
- });
- }
|