regression_logarithmic.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8'>
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <script src="../lib/esl.js"></script>
  7. <script src="../lib/config.js"></script>
  8. <script src="../lib/jquery.min.js"></script>
  9. </head>
  10. <body>
  11. <style>
  12. html, body, #main {
  13. width: 100%;
  14. height: 100%;
  15. margin: 0;
  16. padding: 0;
  17. }
  18. </style>
  19. <div id="main"></div>
  20. <script>
  21. require([
  22. 'echarts',
  23. 'ecStat'
  24. ], function (echarts, ecStat) {
  25. echarts.registerTransform(ecStat.transform.regression);
  26. var chart = echarts.init(document.getElementById('main'));
  27. chart.setOption({
  28. dataset: [{
  29. source: [
  30. [28604,77,17096869,'Australia',1990],
  31. [31163,77.4,27662440,'Canada',1990],
  32. [1516,68,1154605773,'China',1990],
  33. [13670,74.7,10582082,'Cuba',1990],
  34. [28599,75,4986705,'Finland',1990],
  35. [29476,77.1,56943299,'France',1990],
  36. [31476,75.4,78958237,'Germany',1990],
  37. [28666,78.1,254830,'Iceland',1990],
  38. [1777,57.7,870601776,'India',1990],
  39. [29550,79.1,122249285,'Japan',1990],
  40. [2076,67.9,20194354,'North Korea',1990],
  41. [12087,72,42972254,'South Korea',1990],
  42. [24021,75.4,3397534,'New Zealand',1990],
  43. [43296,76.8,4240375,'Norway',1990],
  44. [10088,70.8,38195258,'Poland',1990],
  45. [19349,69.6,147568552,'Russia',1990],
  46. [10670,67.3,53994605,'Turkey',1990],
  47. [26424,75.7,57110117,'United Kingdom',1990],
  48. [37062,75.4,252847810,'United States',1990],
  49. [44056,81.8,23968973,'Australia',2015],
  50. [43294,81.7,35939927,'Canada',2015],
  51. [13334,76.9,1376048943,'China',2015],
  52. [21291,78.5,11389562,'Cuba',2015],
  53. [38923,80.8,5503457,'Finland',2015],
  54. [37599,81.9,64395345,'France',2015],
  55. [44053,81.1,80688545,'Germany',2015],
  56. [42182,82.8,329425,'Iceland',2015],
  57. [5903,66.8,1311050527,'India',2015],
  58. [36162,83.5,126573481,'Japan',2015],
  59. [1390,71.4,25155317,'North Korea',2015],
  60. [34644,80.7,50293439,'South Korea',2015],
  61. [34186,80.6,4528526,'New Zealand',2015],
  62. [64304,81.6,5210967,'Norway',2015],
  63. [24787,77.3,38611794,'Poland',2015],
  64. [23038,73.13,143456918,'Russia',2015],
  65. [19360,76.5,78665830,'Turkey',2015],
  66. [38225,81.4,64715810,'United Kingdom',2015],
  67. [53354,79.1,321773631,'United States',2015]
  68. ]
  69. }, {
  70. transform: {
  71. type: 'filter',
  72. config: { dimension: 4, eq: 1990 }
  73. }
  74. }, {
  75. transform: {
  76. type: 'filter',
  77. config: { dimension: 4, eq: 2015 }
  78. }
  79. }, {
  80. transform: {
  81. type: 'ecStat:regression',
  82. config: {
  83. method: 'logarithmic'
  84. }
  85. }
  86. }],
  87. legend: {
  88. data: ['1990', '2015']
  89. },
  90. tooltip: {
  91. trigger: 'axis',
  92. axisPointer: {
  93. type: 'cross'
  94. }
  95. },
  96. xAxis: {
  97. type: 'value',
  98. splitLine: {
  99. lineStyle: {
  100. type: 'dashed'
  101. }
  102. },
  103. },
  104. yAxis: {
  105. type: 'value',
  106. splitLine: {
  107. lineStyle: {
  108. type: 'dashed'
  109. }
  110. },
  111. },
  112. visualMap: {
  113. show: false,
  114. dimension: 2,
  115. min: 20000,
  116. max: 1500000000,
  117. seriesIndex: [0, 1],
  118. inRange: {
  119. symbolSize: [10, 70]
  120. }
  121. },
  122. series: [{
  123. name: '1990',
  124. type: 'scatter',
  125. datasetIndex: 1
  126. },{
  127. name: '2015',
  128. type: 'scatter',
  129. datasetIndex: 2
  130. }, {
  131. name: 'line',
  132. type: 'line',
  133. smooth: true,
  134. datasetIndex: 3,
  135. symbolSize: 0.1,
  136. symbol: 'circle',
  137. label: { show: true, fontSize: 16 },
  138. labelLayout: { dx: -20 },
  139. encode: { label: 2, tooltip: 1 }
  140. }]
  141. });
  142. });
  143. </script>
  144. </body>
  145. </html>