geo-random-stream.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1" />
  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. </head>
  10. <body>
  11. <style>
  12. html, body, #main {
  13. width: 100%;
  14. height: 100%;
  15. margin: 0;
  16. }
  17. </style>
  18. <div id="main"></div>
  19. <script>
  20. var lngRange = [79.781327, 131.48];
  21. var lngExtent = lngRange[1] - lngRange[0];
  22. var latRange = [18.252847, 52.33];
  23. var latExtent = latRange[1] - latRange[0];
  24. var data = [];
  25. // var count = 1000000;
  26. // var count = 450000;
  27. var count = 1000000;
  28. // var count = 5000;
  29. for (var i = 0; i < count; i++) {
  30. data.push([
  31. Math.random() * lngExtent + lngRange[0],
  32. Math.random() * latExtent + latRange[0],
  33. Math.random() * 1000
  34. ]);
  35. }
  36. require([
  37. 'echarts'
  38. // 'echarts/chart/map',
  39. // 'echarts/chart/scatter',
  40. // 'echarts/component/title',
  41. // 'echarts/component/legend',
  42. // 'echarts/component/geo',
  43. // 'echarts/component/visualMap',
  44. // 'echarts/component/markPoint',
  45. // 'echarts/component/tooltip'
  46. ], function (echarts) {
  47. require(['map/js/china'], function () {
  48. var chart = echarts.init(document.getElementById('main'));
  49. chart.setOption({
  50. tooltip: {},
  51. legend: {
  52. orient: 'vertical',
  53. left: 'left',
  54. data:['categoryA','categoryB','categoryC']
  55. },
  56. // visualMap: {
  57. // min: 0,
  58. // max: 1500,
  59. // left: 'left',
  60. // top: 'bottom',
  61. // text: ['High','Low'],
  62. // seriesIndex: [1, 2, 3],
  63. // inRange: {
  64. // color: ['#006edd', '#e0ffff']
  65. // },
  66. // calculable : true
  67. // },
  68. geo: {
  69. map: 'china',
  70. roam: true,
  71. label: {
  72. normal: {
  73. show: true,
  74. textStyle: {
  75. color: 'rgba(0,0,0,0.4)'
  76. }
  77. }
  78. },
  79. itemStyle: {
  80. normal:{
  81. borderColor: 'rgba(0, 0, 0, 0.2)'
  82. },
  83. emphasis:{
  84. color: null,
  85. areaColor: null,
  86. shadowOffsetX: 0,
  87. shadowOffsetY: 0,
  88. shadowBlur: 20,
  89. borderWidth: 0,
  90. shadowColor: 'rgba(0, 0, 0, 0.5)'
  91. }
  92. }
  93. },
  94. series : [{
  95. name: 'pm2.5',
  96. type: 'scatter',
  97. stream: true,
  98. coordinateSystem: 'geo',
  99. data: data,
  100. symbolSize: 4,
  101. // symbol: 'rect',
  102. itemStyle: {
  103. normal: {
  104. // color: '#ddb926'
  105. color: '#dda'
  106. }
  107. },
  108. progressive: 100
  109. }]
  110. });
  111. chart.on('click', function (param) {
  112. alert('asdf');
  113. });
  114. });
  115. });
  116. </script>
  117. </body>
  118. </html>