bar9.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. var placeHoledStyle = {
  36. normal:{
  37. barBorderColor:'rgba(0,0,0,0)',
  38. color:'rgba(0,0,0,0)'
  39. },
  40. emphasis:{
  41. barBorderColor:'rgba(0,0,0,0)',
  42. color:'rgba(0,0,0,0)'
  43. }
  44. };
  45. var dataStyle = {
  46. normal: {
  47. label : {
  48. show: true,
  49. position: 'insideLeft',
  50. formatter: '{c}%'
  51. }
  52. }
  53. };
  54. option = {
  55. title: {
  56. text: '多维条形图',
  57. subtext: 'From ExcelHome',
  58. sublink: 'http://e.weibo.com/1341556070/AiEscco0H'
  59. },
  60. tooltip : {
  61. trigger: 'axis',
  62. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  63. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  64. },
  65. formatter : '{b}<br/>{a0}:{c0}%<br/>{a2}:{c2}%<br/>{a4}:{c4}%<br/>{a6}:{c6}%'
  66. },
  67. legend: {
  68. y: 55,
  69. itemGap : document.getElementById('main').offsetWidth / 8,
  70. data:['GML', 'PYP','WTC', 'ZTW']
  71. },
  72. toolbox: {
  73. show : true,
  74. feature : {
  75. mark : {show: true},
  76. dataView : {show: true, readOnly: false},
  77. restore : {show: true},
  78. saveAsImage : {show: true}
  79. }
  80. },
  81. grid: {
  82. y: 80,
  83. y2: 30
  84. },
  85. xAxis : [
  86. {
  87. type : 'value',
  88. position: 'top',
  89. splitLine: {show: false},
  90. axisLabel: {show: false}
  91. }
  92. ],
  93. yAxis : [
  94. {
  95. type : 'category',
  96. splitLine: {show: false},
  97. data : ['重庆', '天津', '上海', '北京']
  98. }
  99. ],
  100. series : [
  101. {
  102. name:'GML',
  103. type:'bar',
  104. stack: '总量',
  105. itemStyle : dataStyle,
  106. data:[38, 50, 33, 72]
  107. },
  108. {
  109. name:'GML',
  110. type:'bar',
  111. stack: '总量',
  112. itemStyle: placeHoledStyle,
  113. data:[62, 50, 67, 28]
  114. },
  115. {
  116. name:'PYP',
  117. type:'bar',
  118. stack: '总量',
  119. itemStyle : dataStyle,
  120. data:[61, 41, 42, 30]
  121. },
  122. {
  123. name:'PYP',
  124. type:'bar',
  125. stack: '总量',
  126. itemStyle: placeHoledStyle,
  127. data:[39, 59, 58, 70]
  128. },
  129. {
  130. name:'WTC',
  131. type:'bar',
  132. stack: '总量',
  133. itemStyle : dataStyle,
  134. data:[37, 35, 44, 60]
  135. },
  136. {
  137. name:'WTC',
  138. type:'bar',
  139. stack: '总量',
  140. itemStyle: placeHoledStyle,
  141. data:[63, 65, 56, 40]
  142. },
  143. {
  144. name:'ZTW',
  145. type:'bar',
  146. stack: '总量',
  147. itemStyle : dataStyle,
  148. data:[71, 50, 31, 39]
  149. },
  150. {
  151. name:'ZTW',
  152. type:'bar',
  153. stack: '总量',
  154. itemStyle: placeHoledStyle,
  155. data:[29, 50, 69, 61]
  156. }
  157. ]
  158. };
  159. </textarea>
  160. </div><!--/.well -->
  161. </div><!--/span-->
  162. <div id="graphic" class="col-md-8">
  163. <div id="main" class="main"></div>
  164. <div>
  165. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  166. <span class="text-primary">切换主题</span>
  167. <select id="theme-select"></select>
  168. <span id='wrong-message' style="color:red"></span>
  169. </div>
  170. </div><!--/span-->
  171. </div><!--/row-->
  172. </div><!--/.fluid-container-->
  173. <footer id="footer"></footer>
  174. <!-- Le javascript
  175. ================================================== -->
  176. <!-- Placed at the end of the document so the pages load faster -->
  177. <script src="../asset/js/jquery.min.js"></script>
  178. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  179. <script src="../asset/js/bootstrap.min.js"></script>
  180. <script src="../asset/js/echartsExample.js"></script>
  181. </body>
  182. </html>