8156536823c9803072115b93071f5242adba0a6b.svn-base 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  2. <html>
  3. <head>
  4. <title>chart.html</title>
  5. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  6. <meta http-equiv="description" content="this is my page">
  7. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  8. <script type="text/javascript" src="/nwyj/scripts/jquery/jquery-1.11.1.min.js"></script>
  9. <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/source/echarts.js"></script>
  10. <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/source/echarts-all.js"></script>
  11. <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/source/chart/pie.js"></script>
  12. <script type="text/javascript" src="/nwyj/page/cockpit/context.js"></script>
  13. <style type="text/css">
  14. html,body{
  15. height: 100%;
  16. width: 100%;
  17. }
  18. </style>
  19. <script type="text/javascript">
  20. var chartdata={};
  21. var leng = [];
  22. var myChart ;
  23. $(function(){
  24. var urls = "/nwyj/ws/cockpit/CockpitService/provUserRes";
  25. $.ajax({
  26. url : urls,
  27. type : 'post',
  28. timeout : 15000,
  29. async: false,
  30. data: {deptId:window.top.getDeptId},
  31. dataType : 'json',
  32. success : function(data) {
  33. chartdata = data ;
  34. for(var key in data){
  35. leng.push(data[key]["name"])
  36. }
  37. },
  38. error : function(e) {
  39. $.messager.alert('查询数据失败!', '访问服务失败!', 'error');
  40. }
  41. },'json');
  42. setCharHeight();
  43. initChar();
  44. //自适应
  45. $(window).resize(function(){
  46. myChart.resize();
  47. });
  48. });
  49. /**
  50. *设置高度
  51. */
  52. function setCharHeight(){
  53. var hei = $(document).height() ;
  54. $("#charContent").height(hei);
  55. };
  56. /**
  57. * 图表初始化
  58. */
  59. function initChar(){
  60. myChart = echarts.init($('#charContent').get(0));
  61. var option = {
  62. title : {
  63. text: '全省停电用户复电比例',
  64. x:'center',
  65. textStyle:{color:'#e6f3ff'}
  66. },
  67. color:color1,
  68. tooltip : {
  69. trigger: 'item',
  70. formatter: "{a} <br/>{b} : {c} ({d}%)"
  71. },
  72. /* legend: {
  73. orient : 'vertical',
  74. x : 'left',
  75. data:leng,
  76. textStyle:{color:'auto'}
  77. }, */
  78. toolbox: {
  79. show : false,
  80. feature : {
  81. mark : {show: true},
  82. dataView : {show: true, readOnly: false},
  83. restore : {show: true},
  84. saveAsImage : {show: true}
  85. }
  86. },
  87. calculable : true,
  88. series : [{
  89. name:"复电比例",
  90. type:'pie',
  91. radius : '55%',
  92. center: ['50%', '50%'],
  93. data:chartdata
  94. }],
  95. color: ["#30e0e0","#ffc000", "#b8860b", "#40e0d0", "#1e90ff", "#ff6347", "#7b68ee", "#00fa9a", "#ffd700", "#6699FF", "#ff6666", "#3cb371", "#b8860b", "#30e0e0"]
  96. };
  97. myChart.setOption(option);
  98. };
  99. </script>
  100. </head>
  101. <body bgcolor="#131524">
  102. <div id="charContent" style="width:100%;height:100%"></div>
  103. </body>
  104. </html>