dataZoom-geo.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!DOCTYPE>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <script src="esl.js"></script>
  6. <script src="config.js"></script>
  7. <meta name="viewport" content="width=device-width, initial-scale=1" />
  8. <link rel="stylesheet" href="reset.css">
  9. </head>
  10. <body>
  11. <style>
  12. </style>
  13. <div id="main"></div>
  14. <script>
  15. var chart;
  16. require([
  17. 'echarts',
  18. 'echarts/chart/line',
  19. 'echarts/chart/bar',
  20. 'echarts/chart/scatter',
  21. 'echarts/component/legend',
  22. 'echarts/component/grid',
  23. 'echarts/component/geo',
  24. 'map/js/china',
  25. 'echarts/component/tooltip',
  26. 'echarts/component/dataZoom',
  27. 'echarts/component/markLine'
  28. ], function (echarts) {
  29. chart = echarts.init(document.getElementById('main'));
  30. var option = {
  31. grid: {
  32. top: '60%'
  33. },
  34. title : {
  35. text: '动态数据',
  36. subtext: '纯属虚构'
  37. },
  38. tooltip : {
  39. trigger: 'axis'
  40. },
  41. legend: {
  42. data:['最新成交价']
  43. },
  44. toolbox: {
  45. show : true,
  46. feature : {
  47. dataView : {show: true, readOnly: false},
  48. restore : {show: true},
  49. saveAsImage : {show: true}
  50. }
  51. },
  52. dataZoom : [{
  53. type: 'inside',
  54. start : 0,
  55. end : 100
  56. },
  57. {
  58. type: 'slider',
  59. start : 0,
  60. end : 100
  61. }
  62. ],
  63. xAxis : [
  64. {
  65. type : 'value',
  66. scale: true
  67. }
  68. ],
  69. yAxis : [
  70. {
  71. type : 'value',
  72. scale: true,
  73. name : '预购量',
  74. boundaryGap: [0.2, 0.2]
  75. }
  76. ],
  77. geo: {
  78. map: 'china',
  79. height: '50%',
  80. top: 0
  81. },
  82. series : [
  83. {
  84. type: 'scatter',
  85. coordinateSystem: 'geo'
  86. },
  87. {
  88. name:'最新成交价',
  89. type:'line',
  90. data:(function (){
  91. var res = [];
  92. var len = 0;
  93. while (len < 10) {
  94. var n = [
  95. len,
  96. (Math.random()*10 + 5).toFixed(1)
  97. ];
  98. res.push({name: n[0], value: n});
  99. len++;
  100. }
  101. return res;
  102. })(),
  103. animation: true,
  104. animationDurationUpdate: 500,
  105. animationEasing: 'linear',
  106. animationEasingUpdate: 'linear'
  107. }
  108. ]
  109. };
  110. chart.setOption(option);
  111. });
  112. </script>
  113. </body>
  114. </html>