bar.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. show: true,
  38. trigger: 'item'
  39. },
  40. legend: {
  41. data:['邮件营销','联盟广告','直接访问','搜索引擎']
  42. },
  43. toolbox: {
  44. show : true,
  45. feature : {
  46. mark : {show: true},
  47. dataView : {show: true, readOnly: false},
  48. magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
  49. restore : {show: true},
  50. saveAsImage : {show: true}
  51. }
  52. },
  53. calculable : true,
  54. xAxis : [
  55. {
  56. type : 'category',
  57. data : ['周一','周二','周三','周四','周五','周六','周日']
  58. }
  59. ],
  60. yAxis : [
  61. {
  62. type : 'value'
  63. }
  64. ],
  65. series : [
  66. {
  67. name:'邮件营销',
  68. type:'bar',
  69. itemStyle: { // 系列级个性化样式,纵向渐变填充
  70. normal: {
  71. barBorderColor:'red',
  72. barBorderWidth: 5,
  73. color : (function (){
  74. var zrColor = require('zrender/tool/color');
  75. return zrColor.getLinearGradient(
  76. 0, 400, 0, 300,
  77. [[0, 'green'],[1, 'yellow']]
  78. )
  79. })()
  80. },
  81. emphasis: {
  82. barBorderWidth: 5,
  83. barBorderColor:'green',
  84. color: (function (){
  85. var zrColor = require('zrender/tool/color');
  86. return zrColor.getLinearGradient(
  87. 0, 400, 0, 300,
  88. [[0, 'red'],[1, 'orange']]
  89. )
  90. })(),
  91. label : {
  92. show : true,
  93. position : 'top',
  94. formatter : "{a} {b} {c}",
  95. textStyle : {
  96. color: 'blue'
  97. }
  98. }
  99. }
  100. },
  101. data:[220, 232, 101, 234, 190, 330, 210]
  102. },
  103. {
  104. name:'联盟广告',
  105. type:'bar',
  106. stack: '总量',
  107. data:[120, '-', 451, 134, 190, 230, 110]
  108. },
  109. {
  110. name:'直接访问',
  111. type:'bar',
  112. stack: '总量',
  113. itemStyle: { // 系列级个性化
  114. normal: {
  115. barBorderWidth: 6,
  116. barBorderColor:'tomato',
  117. color: 'red'
  118. },
  119. emphasis: {
  120. barBorderColor:'red',
  121. color: 'blue'
  122. }
  123. },
  124. data:[
  125. 320, 332, 100, 334,
  126. {
  127. value: 390,
  128. symbolSize : 10, // 数据级个性化
  129. itemStyle: {
  130. normal: {
  131. color :'lime'
  132. },
  133. emphasis: {
  134. color: 'skyBlue'
  135. }
  136. }
  137. },
  138. 330, 320
  139. ]
  140. },
  141. {
  142. name:'搜索引擎',
  143. type:'bar',
  144. barWidth: 40, // 系列级个性化,柱形宽度
  145. itemStyle: {
  146. normal: { // 系列级个性化,横向渐变填充
  147. borderRadius: 5,
  148. color : (function (){
  149. var zrColor = require('zrender/tool/color');
  150. return zrColor.getLinearGradient(
  151. 0, 0, 1000, 0,
  152. [[0, 'rgba(30,144,255,0.8)'],[1, 'rgba(138,43,226,0.8)']]
  153. )
  154. })(),
  155. label : {
  156. show : true,
  157. textStyle : {
  158. fontSize : '20',
  159. fontFamily : '微软雅黑',
  160. fontWeight : 'bold'
  161. }
  162. }
  163. }
  164. },
  165. data:[
  166. 620, 732,
  167. {
  168. value: 701,
  169. itemStyle : { normal: {label : {position: 'inside'}}}
  170. },
  171. 734, 890, 930, 820
  172. ],
  173. markLine : {
  174. data : [
  175. {type : 'average', name : '平均值'},
  176. {type : 'max'},
  177. {type : 'min'}
  178. ]
  179. }
  180. }
  181. ]
  182. };
  183. </textarea>
  184. </div><!--/.well -->
  185. </div><!--/span-->
  186. <div id="graphic" class="col-md-8">
  187. <div id="main" class="main"></div>
  188. <div>
  189. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  190. <span class="text-primary">切换主题</span>
  191. <select id="theme-select"></select>
  192. <span id='wrong-message' style="color:red"></span>
  193. </div>
  194. </div><!--/span-->
  195. </div><!--/row-->
  196. </div><!--/.fluid-container-->
  197. <footer id="footer"></footer>
  198. <!-- Le javascript
  199. ================================================== -->
  200. <!-- Placed at the end of the document so the pages load faster -->
  201. <script src="../asset/js/jquery.min.js"></script>
  202. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  203. <script src="../asset/js/bootstrap.min.js"></script>
  204. <script src="../asset/js/echartsExample.js"></script>
  205. </body>
  206. </html>