demo.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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/echartsHome.css" rel="stylesheet">
  14. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  15. <!--[if lt IE 9]>
  16. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  17. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  18. <![endif]-->
  19. <script src="../asset/js/esl/esl.js"></script>
  20. </head>
  21. <body>
  22. <!-- Fixed navbar -->
  23. <div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
  24. <div class="container featurette">
  25. <div class="row">
  26. <div id="graphic" class="col-md-12">
  27. <div id="main" style="height:400px;width:100%"></div>
  28. </div><!--/span-->
  29. </div><!--/row-->
  30. </div><!--/.fluid-container-->
  31. <footer id="footer"></footer>
  32. <!-- Le javascript
  33. ================================================== -->
  34. <!-- Placed at the end of the document so the pages load faster -->
  35. <script src="../asset/js/jquery.min.js"></script>
  36. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  37. <script src="../asset/js/bootstrap.min.js"></script>
  38. <script type="text/javascript">
  39. require.config({
  40. packages: [
  41. {
  42. name: 'echarts',
  43. location: '../../src',
  44. main: 'echarts'
  45. },
  46. {
  47. name: 'zrender',
  48. location: 'http://ecomfe.github.io/zrender/src',
  49. //location: '../../../zrender/src',
  50. main: 'zrender'
  51. }
  52. ]
  53. });
  54. var option = {
  55. tooltip : {
  56. trigger: 'axis'
  57. },
  58. legend: {
  59. data:['蒸发量','降水量']
  60. },
  61. toolbox: {
  62. show : true,
  63. feature : {
  64. mark : {show: true},
  65. dataView : {show: true, readOnly: false},
  66. magicType : {show: true, type: ['line', 'bar']},
  67. restore : {show: true},
  68. saveAsImage : {show: true}
  69. }
  70. },
  71. calculable : true,
  72. xAxis : [
  73. {
  74. type : 'category',
  75. data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
  76. }
  77. ],
  78. yAxis : [
  79. {
  80. type : 'value',
  81. splitArea : {show : true}
  82. }
  83. ],
  84. series : [
  85. {
  86. name:'蒸发量',
  87. type:'bar',
  88. 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]
  89. },
  90. {
  91. name:'降水量',
  92. type:'bar',
  93. 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]
  94. }
  95. ]
  96. };
  97. require(
  98. [
  99. 'echarts',
  100. 'echarts/chart/line',
  101. 'echarts/chart/bar'
  102. ],
  103. function (ec) {
  104. var myChart = ec.init(document.getElementById('main'));
  105. myChart.setOption(option);
  106. }
  107. )
  108. </script>
  109. </body>
  110. </html>