connect.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. margin: 0;
  13. }
  14. #chart1, #chart2 {
  15. width: 50%;
  16. height: 100%;
  17. float: left;
  18. }
  19. </style>
  20. <div id="main">
  21. <div id="chart1"></div>
  22. <div id="chart2"></div>
  23. </div>
  24. <script>
  25. require([
  26. 'echarts',
  27. 'echarts/chart/scatter',
  28. 'echarts/component/legend',
  29. 'echarts/component/grid',
  30. 'echarts/component/visualMap',
  31. 'echarts/component/tooltip'
  32. ], function (echarts) {
  33. var chart1 = echarts.init(document.getElementById('chart1'));
  34. var chart2 = echarts.init(document.getElementById('chart2'));
  35. var data1 = [];
  36. var symbolCount = 6;
  37. for (var i = 0; i < 100; i++) {
  38. data1.push([
  39. Math.random() * 5,
  40. Math.random() * 4,
  41. Math.random() * 20,
  42. Math.round(Math.random() * (symbolCount - 1))
  43. ]);
  44. }
  45. chart1.setOption({
  46. legend: {
  47. top: 50,
  48. data: ['scatter']
  49. },
  50. tooltip: {
  51. formatter: '{c}'
  52. },
  53. grid: {
  54. top: '26%',
  55. bottom: '26%'
  56. },
  57. xAxis: {
  58. type: 'value',
  59. splitLine: {
  60. show: false
  61. }
  62. },
  63. yAxis: {
  64. type: 'value',
  65. splitLine: {
  66. show: false
  67. }
  68. },
  69. visualMap: [
  70. {
  71. realtime: false,
  72. left: 'right',
  73. // selectedMode: 'single',
  74. selectedMode: 'multiple',
  75. backgroundColor: '#eee',
  76. dimension: 2,
  77. selected: [],
  78. min: 0,
  79. max: 24,
  80. precision: 0,
  81. splitNumber: 0,
  82. calculable: true,
  83. inRange: { // visual for short cut
  84. color: ['#006edd', '#e0ffff']
  85. }
  86. }
  87. ],
  88. series: [
  89. {
  90. name: 'scatter',
  91. type: 'scatter',
  92. symbolSize: 30,
  93. data: data1
  94. }
  95. ]
  96. });
  97. chart2.setOption({
  98. legend: {
  99. top: 50,
  100. data: ['scatter']
  101. },
  102. tooltip: {
  103. formatter: '{c}'
  104. },
  105. grid: {
  106. top: '26%',
  107. bottom: '26%'
  108. },
  109. xAxis: {
  110. type: 'value',
  111. splitLine: {
  112. show: false
  113. }
  114. },
  115. yAxis: {
  116. type: 'value',
  117. splitLine: {
  118. show: false
  119. }
  120. },
  121. visualMap: [
  122. {
  123. left: 'right',
  124. // selectedMode: 'single',
  125. selectedMode: 'multiple',
  126. backgroundColor: '#eee',
  127. dimension: 2,
  128. selected: [],
  129. min: 0,
  130. max: 24,
  131. precision: 0,
  132. splitNumber: 0,
  133. calculable: true,
  134. inRange: { // visual for short cut
  135. color: ['#006edd', '#e0ffff']
  136. }
  137. }
  138. ],
  139. series: [
  140. {
  141. name: 'scatter',
  142. type: 'scatter',
  143. symbolSize: 30,
  144. data: data1
  145. }
  146. ]
  147. });
  148. echarts.connect([chart1, chart2]);
  149. });
  150. </script>
  151. </body>
  152. </html>