area-large.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <!DOCTYPE>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <script src="lib/esl.js"></script>
  6. <script src="lib/config.js"></script>
  7. <script src="lib/jquery.min.js"></script>
  8. <script src="lib/facePrint.js"></script>
  9. <script src="lib/testHelper.js"></script>
  10. <meta name="viewport" content="width=device-width, initial-scale=1" />
  11. <link rel="stylesheet" href="lib/reset.css">
  12. </head>
  13. <body>
  14. <style>
  15. h1 {
  16. line-height: 60px;
  17. height: 60px;
  18. background: #146402;
  19. text-align: center;
  20. font-weight: bold;
  21. color: #eee;
  22. font-size: 14px;
  23. }
  24. .chart {
  25. height: 500px;
  26. }
  27. </style>
  28. <div class="chart" id="main"></div>
  29. <script>
  30. var echarts;
  31. var chart;
  32. var myChart;
  33. var groupCategories = [];
  34. var groupColors = [];
  35. require([
  36. 'echarts'
  37. // 'echarts/chart/line',
  38. // 'echarts/chart/bar',
  39. // 'echarts/chart/pie',
  40. // 'echarts/chart/scatter',
  41. // 'echarts/chart/map',
  42. // 'echarts/chart/parallel',
  43. // 'echarts/chart/radar',
  44. // 'echarts/component/grid',
  45. // 'echarts/component/polar',
  46. // 'echarts/component/geo',
  47. // 'echarts/component/singleAxis',
  48. // 'echarts/component/legend',
  49. // 'echarts/component/tooltip',
  50. // 'echarts/component/toolbox',
  51. // 'echarts/component/visualMap',
  52. // 'echarts/component/dataZoom'
  53. ], function (ec) {
  54. echarts = ec;
  55. chart = myChart = echarts.init(document.getElementById('main'));
  56. var base = +new Date(1968, 9, 3);
  57. var oneDay = 24 * 3600 * 1000;
  58. var date = [];
  59. var data = [Math.random() * 300];
  60. for (var i = 1; i < 20000; i++) {
  61. var now = new Date(base += oneDay);
  62. date.push([now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/'));
  63. data.push(Math.round((Math.random() - 0.5) * 20 + data[i - 1]));
  64. }
  65. option = {
  66. tooltip: {
  67. trigger: 'axis',
  68. position: function (pt) {
  69. return [pt[0], '10%'];
  70. }
  71. },
  72. legend: {
  73. data: ['large area']
  74. },
  75. title: {
  76. left: 10,
  77. text: '大数据量面积图',
  78. },
  79. toolbox: {
  80. feature: {
  81. dataZoom: {
  82. yAxisIndex: 'none'
  83. },
  84. restore: {},
  85. saveAsImage: {}
  86. }
  87. },
  88. grid: {
  89. containLabel: true
  90. },
  91. xAxis: {
  92. type: 'category',
  93. boundaryGap: false,
  94. data: date
  95. },
  96. yAxis: {
  97. type: 'value',
  98. boundaryGap: [0, '100%']
  99. },
  100. dataZoom: [{
  101. type: 'inside',
  102. start: 0,
  103. end: 10
  104. }, {
  105. start: 0,
  106. end: 10,
  107. handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
  108. handleSize: '80%',
  109. handleStyle: {
  110. color: '#fff',
  111. shadowBlur: 3,
  112. shadowColor: 'rgba(0, 0, 0, 0.6)',
  113. shadowOffsetX: 2,
  114. shadowOffsetY: 2
  115. }
  116. }],
  117. series: [
  118. {
  119. name:'large area',
  120. type:'line',
  121. smooth:true,
  122. symbol: 'none',
  123. sampling: 'average',
  124. itemStyle: {
  125. normal: {
  126. color: 'rgb(255, 70, 131)'
  127. }
  128. },
  129. areaStyle: {
  130. normal: {
  131. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  132. offset: 0,
  133. color: 'rgb(255, 158, 68)'
  134. }, {
  135. offset: 1,
  136. color: 'rgb(255, 70, 131)'
  137. }])
  138. }
  139. },
  140. data: data
  141. }
  142. ]
  143. };
  144. chart.setOption(option);
  145. });
  146. </script>
  147. </body>
  148. </html>