bar10.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. title : {
  37. text: '温度计式图表',
  38. subtext: 'From ExcelHome',
  39. sublink: 'http://e.weibo.com/1341556070/AizJXrAEa'
  40. },
  41. tooltip : {
  42. trigger: 'axis',
  43. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  44. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  45. },
  46. formatter: function (params){
  47. return params[0].name + '<br/>'
  48. + params[0].seriesName + ' : ' + params[0].value + '<br/>'
  49. + params[1].seriesName + ' : ' + (params[1].value + params[0].value);
  50. }
  51. },
  52. legend: {
  53. selectedMode:false,
  54. data:['Acutal', 'Forecast']
  55. },
  56. toolbox: {
  57. show : true,
  58. feature : {
  59. mark : {show: true},
  60. dataView : {show: true, readOnly: false},
  61. restore : {show: true},
  62. saveAsImage : {show: true}
  63. }
  64. },
  65. calculable : true,
  66. xAxis : [
  67. {
  68. type : 'category',
  69. data : ['Cosco','CMA','APL','OOCL','Wanhai','Zim']
  70. }
  71. ],
  72. yAxis : [
  73. {
  74. type : 'value',
  75. boundaryGap: [0, 0.1]
  76. }
  77. ],
  78. series : [
  79. {
  80. name:'Acutal',
  81. type:'bar',
  82. stack: 'sum',
  83. barCategoryGap: '50%',
  84. itemStyle: {
  85. normal: {
  86. color: 'tomato',
  87. barBorderColor: 'tomato',
  88. barBorderWidth: 6,
  89. barBorderRadius:0,
  90. label : {
  91. show: true, position: 'insideTop'
  92. }
  93. }
  94. },
  95. data:[260, 200, 220, 120, 100, 80]
  96. },
  97. {
  98. name:'Forecast',
  99. type:'bar',
  100. stack: 'sum',
  101. itemStyle: {
  102. normal: {
  103. color: '#fff',
  104. barBorderColor: 'tomato',
  105. barBorderWidth: 6,
  106. barBorderRadius:0,
  107. label : {
  108. show: true,
  109. position: 'top',
  110. formatter: function (params) {
  111. for (var i = 0, l = option.xAxis[0].data.length; i < l; i++) {
  112. if (option.xAxis[0].data[i] == params.name) {
  113. return option.series[0].data[i] + params.value;
  114. }
  115. }
  116. },
  117. textStyle: {
  118. color: 'tomato'
  119. }
  120. }
  121. }
  122. },
  123. data:[40, 80, 50, 80,80, 70]
  124. }
  125. ]
  126. };
  127. </textarea>
  128. </div><!--/.well -->
  129. </div><!--/span-->
  130. <div id="graphic" class="col-md-8">
  131. <div id="main" class="main"></div>
  132. <div>
  133. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  134. <span class="text-primary">切换主题</span>
  135. <select id="theme-select"></select>
  136. <span id='wrong-message' style="color:red"></span>
  137. </div>
  138. </div><!--/span-->
  139. </div><!--/row-->
  140. </div><!--/.fluid-container-->
  141. <footer id="footer"></footer>
  142. <!-- Le javascript
  143. ================================================== -->
  144. <!-- Placed at the end of the document so the pages load faster -->
  145. <script src="../asset/js/jquery.min.js"></script>
  146. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  147. <script src="../asset/js/bootstrap.min.js"></script>
  148. <script src="../asset/js/echartsExample.js"></script>
  149. </body>
  150. </html>