gauge5.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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. backgroundColor: '#1b1b1b',
  37. tooltip : {
  38. formatter: "{a} <br/>{c} {b}"
  39. },
  40. toolbox: {
  41. show : true,
  42. feature : {
  43. mark : {show: true},
  44. restore : {show: true},
  45. saveAsImage : {show: true}
  46. }
  47. },
  48. series : [
  49. {
  50. name:'速度',
  51. type:'gauge',
  52. min:0,
  53. max:220,
  54. splitNumber:11,
  55. axisLine: { // 坐标轴线
  56. lineStyle: { // 属性lineStyle控制线条样式
  57. color: [[0.09, 'lime'],[0.82, '#1e90ff'],[1, '#ff4500']],
  58. width: 3,
  59. shadowColor : '#fff', //默认透明
  60. shadowBlur: 10
  61. }
  62. },
  63. axisLabel: { // 坐标轴小标记
  64. textStyle: { // 属性lineStyle控制线条样式
  65. fontWeight: 'bolder',
  66. color: '#fff',
  67. shadowColor : '#fff', //默认透明
  68. shadowBlur: 10
  69. }
  70. },
  71. axisTick: { // 坐标轴小标记
  72. length :15, // 属性length控制线长
  73. lineStyle: { // 属性lineStyle控制线条样式
  74. color: 'auto',
  75. shadowColor : '#fff', //默认透明
  76. shadowBlur: 10
  77. }
  78. },
  79. splitLine: { // 分隔线
  80. length :25, // 属性length控制线长
  81. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  82. width:3,
  83. color: '#fff',
  84. shadowColor : '#fff', //默认透明
  85. shadowBlur: 10
  86. }
  87. },
  88. pointer: { // 分隔线
  89. shadowColor : '#fff', //默认透明
  90. shadowBlur: 5
  91. },
  92. title : {
  93. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  94. fontWeight: 'bolder',
  95. fontSize: 20,
  96. fontStyle: 'italic',
  97. color: '#fff',
  98. shadowColor : '#fff', //默认透明
  99. shadowBlur: 10
  100. }
  101. },
  102. detail : {
  103. backgroundColor: 'rgba(30,144,255,0.8)',
  104. borderWidth: 1,
  105. borderColor: '#fff',
  106. shadowColor : '#fff', //默认透明
  107. shadowBlur: 5,
  108. offsetCenter: [0, '50%'], // x, y,单位px
  109. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  110. fontWeight: 'bolder',
  111. color: '#fff'
  112. }
  113. },
  114. data:[{value: 40, name: 'km/h'}]
  115. },
  116. {
  117. name:'转速',
  118. type:'gauge',
  119. center : ['25%', '55%'], // 默认全局居中
  120. radius : '50%',
  121. min:0,
  122. max:7,
  123. endAngle:45,
  124. splitNumber:7,
  125. axisLine: { // 坐标轴线
  126. lineStyle: { // 属性lineStyle控制线条样式
  127. color: [[0.29, 'lime'],[0.86, '#1e90ff'],[1, '#ff4500']],
  128. width: 2,
  129. shadowColor : '#fff', //默认透明
  130. shadowBlur: 10
  131. }
  132. },
  133. axisLabel: { // 坐标轴小标记
  134. textStyle: { // 属性lineStyle控制线条样式
  135. fontWeight: 'bolder',
  136. color: '#fff',
  137. shadowColor : '#fff', //默认透明
  138. shadowBlur: 10
  139. }
  140. },
  141. axisTick: { // 坐标轴小标记
  142. length :12, // 属性length控制线长
  143. lineStyle: { // 属性lineStyle控制线条样式
  144. color: 'auto',
  145. shadowColor : '#fff', //默认透明
  146. shadowBlur: 10
  147. }
  148. },
  149. splitLine: { // 分隔线
  150. length :20, // 属性length控制线长
  151. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  152. width:3,
  153. color: '#fff',
  154. shadowColor : '#fff', //默认透明
  155. shadowBlur: 10
  156. }
  157. },
  158. pointer: {
  159. width:5,
  160. shadowColor : '#fff', //默认透明
  161. shadowBlur: 5
  162. },
  163. title : {
  164. offsetCenter: [0, '-30%'], // x, y,单位px
  165. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  166. fontWeight: 'bolder',
  167. fontStyle: 'italic',
  168. color: '#fff',
  169. shadowColor : '#fff', //默认透明
  170. shadowBlur: 10
  171. }
  172. },
  173. detail : {
  174. //backgroundColor: 'rgba(30,144,255,0.8)',
  175. // borderWidth: 1,
  176. borderColor: '#fff',
  177. shadowColor : '#fff', //默认透明
  178. shadowBlur: 5,
  179. width: 80,
  180. height:30,
  181. offsetCenter: [25, '20%'], // x, y,单位px
  182. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  183. fontWeight: 'bolder',
  184. color: '#fff'
  185. }
  186. },
  187. data:[{value: 1.5, name: 'x1000 r/min'}]
  188. },
  189. {
  190. name:'油表',
  191. type:'gauge',
  192. center : ['75%', '50%'], // 默认全局居中
  193. radius : '50%',
  194. min:0,
  195. max:2,
  196. startAngle:135,
  197. endAngle:45,
  198. splitNumber:2,
  199. axisLine: { // 坐标轴线
  200. lineStyle: { // 属性lineStyle控制线条样式
  201. color: [[0.2, 'lime'],[0.8, '#1e90ff'],[1, '#ff4500']],
  202. width: 2,
  203. shadowColor : '#fff', //默认透明
  204. shadowBlur: 10
  205. }
  206. },
  207. axisTick: { // 坐标轴小标记
  208. length :12, // 属性length控制线长
  209. lineStyle: { // 属性lineStyle控制线条样式
  210. color: 'auto',
  211. shadowColor : '#fff', //默认透明
  212. shadowBlur: 10
  213. }
  214. },
  215. axisLabel: {
  216. textStyle: { // 属性lineStyle控制线条样式
  217. fontWeight: 'bolder',
  218. color: '#fff',
  219. shadowColor : '#fff', //默认透明
  220. shadowBlur: 10
  221. },
  222. formatter:function(v){
  223. switch (v + '') {
  224. case '0' : return 'E';
  225. case '1' : return 'Gas';
  226. case '2' : return 'F';
  227. }
  228. }
  229. },
  230. splitLine: { // 分隔线
  231. length :15, // 属性length控制线长
  232. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  233. width:3,
  234. color: '#fff',
  235. shadowColor : '#fff', //默认透明
  236. shadowBlur: 10
  237. }
  238. },
  239. pointer: {
  240. width:2,
  241. shadowColor : '#fff', //默认透明
  242. shadowBlur: 5
  243. },
  244. title : {
  245. show: false
  246. },
  247. detail : {
  248. show: false
  249. },
  250. data:[{value: 0.5, name: 'gas'}]
  251. },
  252. {
  253. name:'水表',
  254. type:'gauge',
  255. center : ['75%', '50%'], // 默认全局居中
  256. radius : '50%',
  257. min:0,
  258. max:2,
  259. startAngle:315,
  260. endAngle:225,
  261. splitNumber:2,
  262. axisLine: { // 坐标轴线
  263. lineStyle: { // 属性lineStyle控制线条样式
  264. color: [[0.2, 'lime'],[0.8, '#1e90ff'],[1, '#ff4500']],
  265. width: 2,
  266. shadowColor : '#fff', //默认透明
  267. shadowBlur: 10
  268. }
  269. },
  270. axisTick: { // 坐标轴小标记
  271. show: false
  272. },
  273. axisLabel: {
  274. textStyle: { // 属性lineStyle控制线条样式
  275. fontWeight: 'bolder',
  276. color: '#fff',
  277. shadowColor : '#fff', //默认透明
  278. shadowBlur: 10
  279. },
  280. formatter:function(v){
  281. switch (v + '') {
  282. case '0' : return 'H';
  283. case '1' : return 'Water';
  284. case '2' : return 'C';
  285. }
  286. }
  287. },
  288. splitLine: { // 分隔线
  289. length :15, // 属性length控制线长
  290. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  291. width:3,
  292. color: '#fff',
  293. shadowColor : '#fff', //默认透明
  294. shadowBlur: 10
  295. }
  296. },
  297. pointer: {
  298. width:2,
  299. shadowColor : '#fff', //默认透明
  300. shadowBlur: 5
  301. },
  302. title : {
  303. show: false
  304. },
  305. detail : {
  306. show: false
  307. },
  308. data:[{value: 0.5, name: 'gas'}]
  309. }
  310. ]
  311. };
  312. clearInterval(timeTicket);
  313. timeTicket = setInterval(function (){
  314. option.series[0].data[0].value = (Math.random()*100).toFixed(2) - 0;
  315. option.series[1].data[0].value = (Math.random()*7).toFixed(2) - 0;
  316. option.series[2].data[0].value = (Math.random()*2).toFixed(2) - 0;
  317. option.series[3].data[0].value = (Math.random()*2).toFixed(2) - 0;
  318. myChart.setOption(option,true);
  319. },2000)
  320. </textarea>
  321. </div><!--/.well -->
  322. </div><!--/span-->
  323. <div id="graphic" class="col-md-8">
  324. <div id="main" class="main"></div>
  325. <div>
  326. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  327. <span class="text-primary">切换主题</span>
  328. <select id="theme-select"></select>
  329. <span id='wrong-message' style="color:red"></span>
  330. </div>
  331. </div><!--/span-->
  332. </div><!--/row-->
  333. </div><!--/.fluid-container-->
  334. <footer id="footer"></footer>
  335. <!-- Le javascript
  336. ================================================== -->
  337. <!-- Placed at the end of the document so the pages load faster -->
  338. <script src="../asset/js/jquery.min.js"></script>
  339. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  340. <script src="../asset/js/bootstrap.min.js"></script>
  341. <script type="text/javascript">var timeTicket;</script>
  342. <script src="../asset/js/echartsExample.js"></script>
  343. </body>
  344. </html>