gauge3.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="ECharts">
  8. <meta name="author" content="kener.linfeng@gmail.com">
  9. <title>ECharts · Example</title>
  10. <link rel="shortcut icon" href="../asset/ico/favicon.png">
  11. <link href="../asset/css/font-awesome.min.css" rel="stylesheet">
  12. <link href="../asset/css/bootstrap.css" rel="stylesheet">
  13. <link href="../asset/css/carousel.css" rel="stylesheet">
  14. <link href="../asset/css/echartsHome.css" rel="stylesheet">
  15. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  16. <!--[if lt IE 9]>
  17. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  18. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  19. <![endif]-->
  20. <script src="./www/js/echarts.js"></script>
  21. <script src="../asset/js/codemirror.js"></script>
  22. <script src="../asset/js/javascript.js"></script>
  23. <link href="../asset/css/codemirror.css" rel="stylesheet">
  24. <link href="../asset/css/monokai.css" rel="stylesheet">
  25. </head>
  26. <body>
  27. <!-- Fixed navbar -->
  28. <div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
  29. <div class="container-fluid">
  30. <div class="row-fluid example">
  31. <div id="sidebar-code" class="col-md-4">
  32. <div class="well sidebar-nav">
  33. <div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
  34. <textarea id="code" name="code">
  35. option = {
  36. tooltip : {
  37. formatter: "{a} <br/>{b} : {c}%"
  38. },
  39. toolbox: {
  40. show : true,
  41. feature : {
  42. mark : {show: true},
  43. restore : {show: true},
  44. saveAsImage : {show: true}
  45. }
  46. },
  47. series : [
  48. {
  49. name:'业务指标',
  50. type:'gauge',
  51. startAngle: 180,
  52. endAngle: 0,
  53. center : ['50%', '90%'], // 默认全局居中
  54. radius : 320,
  55. axisLine: { // 坐标轴线
  56. lineStyle: { // 属性lineStyle控制线条样式
  57. width: 200
  58. }
  59. },
  60. axisTick: { // 坐标轴小标记
  61. splitNumber: 10, // 每份split细分多少段
  62. length :12, // 属性length控制线长
  63. },
  64. axisLabel: { // 坐标轴文本标签,详见axis.axisLabel
  65. formatter: function(v){
  66. switch (v+''){
  67. case '10': return '低';
  68. case '50': return '中';
  69. case '90': return '高';
  70. default: return '';
  71. }
  72. },
  73. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  74. color: '#fff',
  75. fontSize: 15,
  76. fontWeight: 'bolder'
  77. }
  78. },
  79. pointer: {
  80. width:50,
  81. length: '90%',
  82. color: 'rgba(255, 255, 255, 0.8)'
  83. },
  84. title : {
  85. show : true,
  86. offsetCenter: [0, '-60%'], // x, y,单位px
  87. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  88. color: '#fff',
  89. fontSize: 30
  90. }
  91. },
  92. detail : {
  93. show : true,
  94. backgroundColor: 'rgba(0,0,0,0)',
  95. borderWidth: 0,
  96. borderColor: '#ccc',
  97. width: 100,
  98. height: 40,
  99. offsetCenter: [0, -40], // x, y,单位px
  100. formatter:'{value}%',
  101. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  102. fontSize : 50
  103. }
  104. },
  105. data:[{value: 50, name: '完成率'}]
  106. }
  107. ]
  108. };
  109. clearInterval(timeTicket);
  110. timeTicket = setInterval(function (){
  111. option.series[0].data[0].value = (Math.random()*100).toFixed(2) - 0;
  112. myChart.setOption(option,true);
  113. },2000)
  114. </textarea>
  115. </div><!--/.well -->
  116. </div><!--/span-->
  117. <div id="graphic" class="col-md-8">
  118. <div id="main" class="main"></div>
  119. <div>
  120. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  121. <span class="text-primary">切换主题</span>
  122. <select id="theme-select"></select>
  123. <span id='wrong-message' style="color:red"></span>
  124. </div>
  125. </div><!--/span-->
  126. </div><!--/row-->
  127. </div><!--/.fluid-container-->
  128. <footer id="footer"></footer>
  129. <!-- Le javascript
  130. ================================================== -->
  131. <!-- Placed at the end of the document so the pages load faster -->
  132. <script src="../asset/js/jquery.min.js"></script>
  133. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  134. <script src="../asset/js/bootstrap.min.js"></script>
  135. <script type="text/javascript">var timeTicket;</script>
  136. <script src="../asset/js/echartsExample.js"></script>
  137. </body>
  138. </html>