dataZoom-scatter-hv.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <script src="esl.js"></script>
  5. <script src="config.js"></script>
  6. </head>
  7. <body>
  8. <style>
  9. html, body, #main {
  10. width: 100%;
  11. height: 100%;
  12. }
  13. </style>
  14. <div id="main"></div>
  15. <script>
  16. require([
  17. 'echarts',
  18. 'echarts/chart/scatter',
  19. 'echarts/component/legend',
  20. 'echarts/component/grid',
  21. 'echarts/component/tooltip',
  22. 'echarts/component/dataZoom'
  23. ], function (echarts) {
  24. var chart = echarts.init(document.getElementById('main'), null, {
  25. renderer: 'canvas'
  26. });
  27. var data1 = [];
  28. var data2 = [];
  29. var data3 = [];
  30. var random = function (max) {
  31. return (Math.random() * max).toFixed(3);
  32. };
  33. for (var i = 0; i < 100000; i++) {
  34. data1.push([random(15), random(10), random(1)]);
  35. // data1.push([i, 10, i]);
  36. data2.push([random(10), random(10), random(1)]);
  37. data3.push([random(15), random(10), random(1)]);
  38. }
  39. // console.profile('setOption');
  40. chart.setOption({
  41. animation: false,
  42. legend: {
  43. data: ['scatter', 'scatter2', 'scatter3']
  44. },
  45. tooltip: {
  46. },
  47. xAxis: {
  48. type: 'value',
  49. min: 'dataMin',
  50. max: 'dataMax',
  51. splitLine: {
  52. show: true
  53. }
  54. },
  55. yAxis: {
  56. type: 'value',
  57. min: 'dataMin',
  58. max: 'dataMax',
  59. splitLine: {
  60. show: true
  61. }
  62. },
  63. dataZoom: [
  64. {
  65. show: true,
  66. xAxisIndex: [0],
  67. start: 1,
  68. end: 5
  69. },
  70. {
  71. show: true,
  72. yAxisIndex: [0],
  73. start: 29,
  74. end: 36
  75. },
  76. {
  77. type: 'inside',
  78. xAxisIndex: [0],
  79. start: 1,
  80. end: 5
  81. },
  82. {
  83. type: 'inside',
  84. yAxisIndex: [0],
  85. start: 29,
  86. end: 36
  87. }
  88. ],
  89. series: [
  90. {
  91. name: 'scatter',
  92. type: 'scatter',
  93. itemStyle: {
  94. normal: {
  95. opacity: 0.8,
  96. // shadowBlur: 10,
  97. // shadowOffsetX: 0,
  98. // shadowOffsetY: 0,
  99. // shadowColor: 'rgba(0, 0, 0, 0.5)'
  100. }
  101. },
  102. symbolSize: function (val) {
  103. return val[2] * 40;
  104. },
  105. data: data1
  106. },
  107. {
  108. name: 'scatter2',
  109. type: 'scatter',
  110. itemStyle: {
  111. normal: {
  112. opacity: 0.8
  113. }
  114. },
  115. symbolSize: function (val) {
  116. return val[2] * 40;
  117. },
  118. data: data2
  119. },
  120. {
  121. name: 'scatter3',
  122. type: 'scatter',
  123. itemStyle: {
  124. normal: {
  125. opacity: 0.8,
  126. }
  127. },
  128. symbolSize: function (val) {
  129. return val[2] * 40;
  130. },
  131. data: data3
  132. }
  133. ]
  134. });
  135. // console.profileEnd('setOption');
  136. })
  137. </script>
  138. <script src="js/memory-stats.js"></script>
  139. <script src="js/memory.js"></script>
  140. </body>
  141. </html>