gauge.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. center : ['50%', '50%'], // 默认全局居中
  52. radius : [0, '75%'],
  53. startAngle: 140,
  54. endAngle : -140,
  55. min: 0, // 最小值
  56. max: 100, // 最大值
  57. precision: 0, // 小数精度,默认为0,无小数点
  58. splitNumber: 10, // 分割段数,默认为5
  59. axisLine: { // 坐标轴线
  60. show: true, // 默认显示,属性show控制显示与否
  61. lineStyle: { // 属性lineStyle控制线条样式
  62. color: [[0.2, 'lightgreen'],[0.4, 'orange'],[0.8, 'skyblue'],[1, '#ff4500']],
  63. width: 30
  64. }
  65. },
  66. axisTick: { // 坐标轴小标记
  67. show: true, // 属性show控制显示与否,默认不显示
  68. splitNumber: 5, // 每份split细分多少段
  69. length :8, // 属性length控制线长
  70. lineStyle: { // 属性lineStyle控制线条样式
  71. color: '#eee',
  72. width: 1,
  73. type: 'solid'
  74. }
  75. },
  76. axisLabel: { // 坐标轴文本标签,详见axis.axisLabel
  77. show: true,
  78. formatter: function(v){
  79. switch (v+''){
  80. case '10': return '弱';
  81. case '30': return '低';
  82. case '60': return '中';
  83. case '90': return '高';
  84. default: return '';
  85. }
  86. },
  87. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  88. color: '#333'
  89. }
  90. },
  91. splitLine: { // 分隔线
  92. show: true, // 默认显示,属性show控制显示与否
  93. length :30, // 属性length控制线长
  94. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  95. color: '#eee',
  96. width: 2,
  97. type: 'solid'
  98. }
  99. },
  100. pointer : {
  101. length : '80%',
  102. width : 8,
  103. color : 'auto'
  104. },
  105. title : {
  106. show : true,
  107. offsetCenter: ['-65%', -10], // x, y,单位px
  108. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  109. color: '#333',
  110. fontSize : 15
  111. }
  112. },
  113. detail : {
  114. show : true,
  115. backgroundColor: 'rgba(0,0,0,0)',
  116. borderWidth: 0,
  117. borderColor: '#ccc',
  118. width: 100,
  119. height: 40,
  120. offsetCenter: ['-60%', 10], // x, y,单位px
  121. formatter:'{value}%',
  122. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  123. color: 'auto',
  124. fontSize : 30
  125. }
  126. },
  127. data:[{value: 50, name: '仪表盘'}]
  128. }
  129. ]
  130. };
  131. clearInterval(timeTicket);
  132. timeTicket = setInterval(function (){
  133. option.series[0].data[0].value = (Math.random()*100).toFixed(2) - 0;
  134. myChart.setOption(option, true);
  135. },2000)
  136. </textarea>
  137. </div><!--/.well -->
  138. </div><!--/span-->
  139. <div id="graphic" class="col-md-8">
  140. <div id="main" class="main"></div>
  141. <div>
  142. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  143. <span class="text-primary">切换主题</span>
  144. <select id="theme-select"></select>
  145. <span id='wrong-message' style="color:red"></span>
  146. </div>
  147. </div><!--/span-->
  148. </div><!--/row-->
  149. </div><!--/.fluid-container-->
  150. <footer id="footer"></footer>
  151. <!-- Le javascript
  152. ================================================== -->
  153. <!-- Placed at the end of the document so the pages load faster -->
  154. <script src="../asset/js/jquery.min.js"></script>
  155. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  156. <script src="../asset/js/bootstrap.min.js"></script>
  157. <script type="text/javascript">var timeTicket;</script>
  158. <script src="../asset/js/echartsExample.js"></script>
  159. </body>
  160. </html>