axis.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. trigger: 'axis'
  38. },
  39. legend: {
  40. data:['蒸发量','降水量','最低气温','最高气温']
  41. },
  42. toolbox: {
  43. show : true,
  44. feature : {
  45. mark : {show: true},
  46. dataView : {show: true},
  47. magicType : {show: true, type: ['line', 'bar']},
  48. restore : {show: true},
  49. saveAsImage : {show: true}
  50. }
  51. },
  52. xAxis : [
  53. {
  54. type : 'category',
  55. position: 'bottom',
  56. boundaryGap: true,
  57. axisLine : { // 轴线
  58. show: true,
  59. lineStyle: {
  60. color: 'green',
  61. type: 'solid',
  62. width: 2
  63. }
  64. },
  65. axisTick : { // 轴标记
  66. show:true,
  67. length: 10,
  68. lineStyle: {
  69. color: 'red',
  70. type: 'solid',
  71. width: 2
  72. }
  73. },
  74. axisLabel : {
  75. show:true,
  76. interval: 'auto', // {number}
  77. rotate: 45,
  78. margin: 8,
  79. formatter: '{value}月',
  80. textStyle: {
  81. color: 'blue',
  82. fontFamily: 'sans-serif',
  83. fontSize: 15,
  84. fontStyle: 'italic',
  85. fontWeight: 'bold'
  86. }
  87. },
  88. splitLine : {
  89. show:true,
  90. lineStyle: {
  91. color: '#483d8b',
  92. type: 'dashed',
  93. width: 1
  94. }
  95. },
  96. splitArea : {
  97. show: true,
  98. areaStyle:{
  99. color:['rgba(144,238,144,0.3)','rgba(135,200,250,0.3)']
  100. }
  101. },
  102. data : [
  103. '1','2','3','4','5',
  104. {
  105. value:'6',
  106. textStyle: {
  107. color: 'red',
  108. fontSize: 30,
  109. fontStyle: 'normal',
  110. fontWeight: 'bold'
  111. }
  112. },
  113. '7','8','9','10','11','12'
  114. ]
  115. },
  116. {
  117. type : 'category',
  118. data : ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
  119. }
  120. ],
  121. yAxis : [
  122. {
  123. type : 'value',
  124. position: 'left',
  125. //min: 0,
  126. //max: 300,
  127. //splitNumber: 5,
  128. boundaryGap: [0,0.1],
  129. axisLine : { // 轴线
  130. show: true,
  131. lineStyle: {
  132. color: 'red',
  133. type: 'dashed',
  134. width: 2
  135. }
  136. },
  137. axisTick : { // 轴标记
  138. show:true,
  139. length: 10,
  140. lineStyle: {
  141. color: 'green',
  142. type: 'solid',
  143. width: 2
  144. }
  145. },
  146. axisLabel : {
  147. show:true,
  148. interval: 'auto', // {number}
  149. rotate: -45,
  150. margin: 18,
  151. formatter: '{value} ml', // Template formatter!
  152. textStyle: {
  153. color: '#1e90ff',
  154. fontFamily: 'verdana',
  155. fontSize: 10,
  156. fontStyle: 'normal',
  157. fontWeight: 'bold'
  158. }
  159. },
  160. splitLine : {
  161. show:true,
  162. lineStyle: {
  163. color: '#483d8b',
  164. type: 'dotted',
  165. width: 2
  166. }
  167. },
  168. splitArea : {
  169. show: true,
  170. areaStyle:{
  171. color:['rgba(205,92,92,0.3)','rgba(255,215,0,0.3)']
  172. }
  173. }
  174. },
  175. {
  176. type : 'value',
  177. splitNumber: 10,
  178. axisLabel : {
  179. formatter: function (value) {
  180. // Function formatter
  181. return value + ' °C'
  182. }
  183. },
  184. splitLine : {
  185. show: false
  186. }
  187. }
  188. ],
  189. series : [
  190. {
  191. name: '蒸发量',
  192. type: 'bar',
  193. data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
  194. },
  195. {
  196. name: '降水量',
  197. type: 'bar',
  198. data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
  199. },
  200. {
  201. name:'最低气温',
  202. type: 'line',
  203. yAxisIndex: 1,
  204. data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
  205. },
  206. {
  207. name:'最高气温',
  208. type: 'line',
  209. xAxisIndex: 1,
  210. yAxisIndex: 1,
  211. data: [12.0, 12.2, 13.3, 14.5, 16.3, 18.2, 28.3, 33.4, 31.0, 24.5, 18.0, 16.2]
  212. }
  213. ]
  214. };
  215. </textarea>
  216. </div><!--/.well -->
  217. </div><!--/span-->
  218. <div id="graphic" class="col-md-8">
  219. <div id="main" class="main"></div>
  220. <div>
  221. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  222. <span class="text-primary">切换主题</span>
  223. <select id="theme-select"></select>
  224. <span id='wrong-message' style="color:red"></span>
  225. </div>
  226. </div><!--/span-->
  227. </div><!--/row-->
  228. </div><!--/.fluid-container-->
  229. <footer id="footer"></footer>
  230. <!-- Le javascript
  231. ================================================== -->
  232. <!-- Placed at the end of the document so the pages load faster -->
  233. <script src="../asset/js/jquery.min.js"></script>
  234. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  235. <script src="../asset/js/bootstrap.min.js"></script>
  236. <script src="../asset/js/echartsExample.js"></script>
  237. </body>
  238. </html>