gauge4.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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/>{c} {b}"
  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. min:0,
  52. max:220,
  53. splitNumber:11,
  54. axisLine: { // 坐标轴线
  55. lineStyle: { // 属性lineStyle控制线条样式
  56. width: 10
  57. }
  58. },
  59. axisTick: { // 坐标轴小标记
  60. length :15, // 属性length控制线长
  61. lineStyle: { // 属性lineStyle控制线条样式
  62. color: 'auto'
  63. }
  64. },
  65. splitLine: { // 分隔线
  66. length :20, // 属性length控制线长
  67. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  68. color: 'auto'
  69. }
  70. },
  71. title : {
  72. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  73. fontWeight: 'bolder',
  74. fontSize: 20,
  75. fontStyle: 'italic'
  76. }
  77. },
  78. detail : {
  79. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  80. fontWeight: 'bolder'
  81. }
  82. },
  83. data:[{value: 40, name: 'km/h'}]
  84. },
  85. {
  86. name:'转速',
  87. type:'gauge',
  88. center : ['25%', '55%'], // 默认全局居中
  89. radius : '50%',
  90. min:0,
  91. max:7,
  92. endAngle:45,
  93. splitNumber:7,
  94. axisLine: { // 坐标轴线
  95. lineStyle: { // 属性lineStyle控制线条样式
  96. width: 8
  97. }
  98. },
  99. axisTick: { // 坐标轴小标记
  100. length :12, // 属性length控制线长
  101. lineStyle: { // 属性lineStyle控制线条样式
  102. color: 'auto'
  103. }
  104. },
  105. splitLine: { // 分隔线
  106. length :20, // 属性length控制线长
  107. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  108. color: 'auto'
  109. }
  110. },
  111. pointer: {
  112. width:5
  113. },
  114. title : {
  115. offsetCenter: [0, '-30%'], // x, y,单位px
  116. },
  117. detail : {
  118. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  119. fontWeight: 'bolder'
  120. }
  121. },
  122. data:[{value: 1.5, name: 'x1000 r/min'}]
  123. },
  124. {
  125. name:'油表',
  126. type:'gauge',
  127. center : ['75%', '50%'], // 默认全局居中
  128. radius : '50%',
  129. min:0,
  130. max:2,
  131. startAngle:135,
  132. endAngle:45,
  133. splitNumber:2,
  134. axisLine: { // 坐标轴线
  135. lineStyle: { // 属性lineStyle控制线条样式
  136. color: [[0.2, '#ff4500'],[0.8, '#48b'],[1, '#228b22']],
  137. width: 8
  138. }
  139. },
  140. axisTick: { // 坐标轴小标记
  141. splitNumber:5,
  142. length :10, // 属性length控制线长
  143. lineStyle: { // 属性lineStyle控制线条样式
  144. color: 'auto'
  145. }
  146. },
  147. axisLabel: {
  148. formatter:function(v){
  149. switch (v + '') {
  150. case '0' : return 'E';
  151. case '1' : return 'Gas';
  152. case '2' : return 'F';
  153. }
  154. }
  155. },
  156. splitLine: { // 分隔线
  157. length :15, // 属性length控制线长
  158. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  159. color: 'auto'
  160. }
  161. },
  162. pointer: {
  163. width:2
  164. },
  165. title : {
  166. show: false
  167. },
  168. detail : {
  169. show: false
  170. },
  171. data:[{value: 0.5, name: 'gas'}]
  172. },
  173. {
  174. name:'水表',
  175. type:'gauge',
  176. center : ['75%', '50%'], // 默认全局居中
  177. radius : '50%',
  178. min:0,
  179. max:2,
  180. startAngle:315,
  181. endAngle:225,
  182. splitNumber:2,
  183. axisLine: { // 坐标轴线
  184. lineStyle: { // 属性lineStyle控制线条样式
  185. color: [[0.2, '#ff4500'],[0.8, '#48b'],[1, '#228b22']],
  186. width: 8
  187. }
  188. },
  189. axisTick: { // 坐标轴小标记
  190. show: false
  191. },
  192. axisLabel: {
  193. formatter:function(v){
  194. switch (v + '') {
  195. case '0' : return 'H';
  196. case '1' : return 'Water';
  197. case '2' : return 'C';
  198. }
  199. }
  200. },
  201. splitLine: { // 分隔线
  202. length :15, // 属性length控制线长
  203. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  204. color: 'auto'
  205. }
  206. },
  207. pointer: {
  208. width:2
  209. },
  210. title : {
  211. show: false
  212. },
  213. detail : {
  214. show: false
  215. },
  216. data:[{value: 0.5, name: 'gas'}]
  217. }
  218. ]
  219. };
  220. clearInterval(timeTicket);
  221. timeTicket = setInterval(function (){
  222. option.series[0].data[0].value = (Math.random()*100).toFixed(2) - 0;
  223. option.series[1].data[0].value = (Math.random()*7).toFixed(2) - 0;
  224. option.series[2].data[0].value = (Math.random()*2).toFixed(2) - 0;
  225. option.series[3].data[0].value = (Math.random()*2).toFixed(2) - 0;
  226. myChart.setOption(option,true);
  227. },2000)
  228. </textarea>
  229. </div><!--/.well -->
  230. </div><!--/span-->
  231. <div id="graphic" class="col-md-8">
  232. <div id="main" class="main"></div>
  233. <div>
  234. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  235. <span class="text-primary">切换主题</span>
  236. <select id="theme-select"></select>
  237. <span id='wrong-message' style="color:red"></span>
  238. </div>
  239. </div><!--/span-->
  240. </div><!--/row-->
  241. </div><!--/.fluid-container-->
  242. <footer id="footer"></footer>
  243. <!-- Le javascript
  244. ================================================== -->
  245. <!-- Placed at the end of the document so the pages load faster -->
  246. <script src="../asset/js/jquery.min.js"></script>
  247. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  248. <script src="../asset/js/bootstrap.min.js"></script>
  249. <script type="text/javascript">var timeTicket;</script>
  250. <script src="../asset/js/echartsExample.js"></script>
  251. </body>
  252. </html>