scatter-stream-visual.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <script src="lib/esl.js"></script>
  5. <script src="lib/config.js"></script>
  6. <script src="lib/jquery.min.js"></script>
  7. <meta name="viewport" content="width=device-width, initial-scale=1" />
  8. <link rel="stylesheet" href="lib/reset.css">
  9. </head>
  10. <body>
  11. <style>
  12. .chart {
  13. width: 100%;
  14. height: 600px;
  15. }
  16. h2 {
  17. text-align: center;
  18. font-size: 16px;
  19. line-height: 30px;
  20. font-weight: normal;
  21. color: #eee;
  22. background: #333;
  23. }
  24. .foot {
  25. font-size: 12px;
  26. color: #999;
  27. text-align: center;
  28. }
  29. </style>
  30. <h2></h2>
  31. <div class="chart" id="main0"></div>
  32. <div class="foot">
  33. Thanks to: 若怀冰 <br>
  34. http://gallery.echartsjs.com/explore.html?u=bd-16906679 <br>
  35. http://gallery.echartsjs.com/editor.html?c=xHJw-hVqjW
  36. </div>
  37. <script>
  38. var echarts;
  39. var data;
  40. require([
  41. 'echarts'
  42. ], function (ec) {
  43. echarts = ec;
  44. echarts && data && init();
  45. });
  46. $.getJSON('./data/house-price-area2.json', function (d) {
  47. data = d;
  48. echarts && data && init();
  49. });
  50. function init() {
  51. var el = document.getElementById('main0');
  52. var chart = echarts.init(el);
  53. var option = {
  54. title: {
  55. text: 'Dispersion of house price based on the area',
  56. left: 'center',
  57. top: 0
  58. },
  59. visualMap: {
  60. min: 15202,
  61. max: 159980,
  62. dimension: 1,
  63. orient: 'vertical',
  64. right: 10,
  65. top: 'center',
  66. text: ['HIGH', 'LOW'],
  67. calculable: true,
  68. inRange: {
  69. color: ['#f2c31a', '#24b7f2']
  70. }
  71. },
  72. tooltip: {
  73. trigger: 'item',
  74. axisPointer: {
  75. type: 'cross'
  76. }
  77. },
  78. xAxis: [{
  79. type: 'value'
  80. }],
  81. yAxis: [{
  82. type: 'value'
  83. }],
  84. series: [{
  85. name: 'price-area',
  86. type: 'scatter',
  87. symbolSize: 5,
  88. // itemStyle: {
  89. // normal: {
  90. // borderWidth: 0.2,
  91. // borderColor: '#fff'
  92. // }
  93. // },
  94. data: data
  95. }]
  96. };
  97. chart.setOption(option);
  98. }
  99. </script>
  100. </body>
  101. </html>