123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
- <html>
- <head>
- <title>chart.html</title>
- <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
- <meta http-equiv="description" content="this is my page">
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-
-
- <script type="text/javascript" src="/nwyj/scripts/jquery/jquery-1.11.1.min.js"></script>
- <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/source/echarts.js"></script>
- <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/source/echarts-all.js"></script>
- <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/source/chart/pie.js"></script>
- <script type="text/javascript" src="/nwyj/page/cockpit/context.js"></script>
- <style type="text/css">
- html,body{
- height: 100%;
- width: 100%;
- }
- </style>
-
- <script type="text/javascript">
- var chartdata={};
- var leng = [];
- var myChart ;
- $(function(){
- var urls = "/nwyj/ws/cockpit/CockpitService/provUserRes";
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 15000,
- async: false,
- data: {deptId:window.top.getDeptId},
- dataType : 'json',
- success : function(data) {
- chartdata = data ;
- for(var key in data){
- leng.push(data[key]["name"])
- }
- },
- error : function(e) {
- $.messager.alert('查询数据失败!', '访问服务失败!', 'error');
- }
- },'json');
- setCharHeight();
- initChar();
- //自适应
- $(window).resize(function(){
- myChart.resize();
- });
- });
- /**
- *设置高度
- */
- function setCharHeight(){
- var hei = $(document).height() ;
- $("#charContent").height(hei);
- };
- /**
- * 图表初始化
- */
- function initChar(){
- myChart = echarts.init($('#charContent').get(0));
-
- var option = {
- title : {
- text: '全省停电用户复电比例',
- x:'center',
- textStyle:{color:'#e6f3ff'}
- },
- color:color1,
- tooltip : {
- trigger: 'item',
- formatter: "{a} <br/>{b} : {c} ({d}%)"
- },
- /* legend: {
- orient : 'vertical',
- x : 'left',
- data:leng,
- textStyle:{color:'auto'}
- }, */
- toolbox: {
- show : false,
- feature : {
- mark : {show: true},
- dataView : {show: true, readOnly: false},
- restore : {show: true},
- saveAsImage : {show: true}
- }
- },
- calculable : true,
- series : [{
- name:"复电比例",
- type:'pie',
- radius : '55%',
- center: ['50%', '50%'],
- data:chartdata
- }],
- color: ["#30e0e0","#ffc000", "#b8860b", "#40e0d0", "#1e90ff", "#ff6347", "#7b68ee", "#00fa9a", "#ffd700", "#6699FF", "#ff6666", "#3cb371", "#b8860b", "#30e0e0"]
- };
- myChart.setOption(option);
- };
- </script>
- </head>
-
- <body bgcolor="#131524">
- <div id="charContent" style="width:100%;height:100%"></div>
- </body>
- </html>
|