dataZoom-scatter-hv-polar.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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/polar',
  21. 'echarts/component/dataZoom'
  22. ], function (echarts) {
  23. var chart = echarts.init(document.getElementById('main'), null, {
  24. renderer: 'canvas'
  25. });
  26. var data1 = [];
  27. var data2 = [];
  28. var data3 = [];
  29. for (var i = 0; i < 100; i++) {
  30. data1.push([Math.random() * 5, Math.random() * 360]);
  31. data2.push([Math.random() * 5, Math.random() * 360]);
  32. data3.push([Math.random() * 10, Math.random() * 360]);
  33. }
  34. chart.setOption({
  35. legend: {
  36. data: ['scatter', 'scatter2', 'scatter3']
  37. },
  38. polar: {
  39. },
  40. angleAxis: {
  41. type: 'value'
  42. },
  43. radiusAxis: {
  44. axisAngle: 0
  45. },
  46. dataZoom: [
  47. {
  48. show: true,
  49. orient: 'vertical',
  50. angleAxisIndex: [0]
  51. },
  52. {
  53. show: true,
  54. orient: 'horizontal',
  55. radiusAxisIndex: [0]
  56. }
  57. ],
  58. series: [{
  59. coordinateSystem: 'polar',
  60. // FIXME
  61. // 现在必须得设置这个,能不能polar和catesian一样,要不然很多特殊处理。
  62. angleAxisIndex: 0,
  63. radiusAxisIndex: 0,
  64. name: 'scatter',
  65. type: 'scatter',
  66. symbolSize: 10,
  67. data: data1
  68. }, {
  69. coordinateSystem: 'polar',
  70. angleAxisIndex: 0,
  71. radiusAxisIndex: 0,
  72. name: 'scatter2',
  73. type: 'scatter',
  74. symbolSize: 10,
  75. data: data2
  76. }, {
  77. coordinateSystem: 'polar',
  78. angleAxisIndex: 0,
  79. radiusAxisIndex: 0,
  80. name: 'scatter3',
  81. type: 'scatter',
  82. symbolSize: 10,
  83. data: data3
  84. }]
  85. });
  86. })
  87. </script>
  88. </body>
  89. </html>