polarScatter.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. ], function (echarts) {
  22. var chart = echarts.init(document.getElementById('main'), null, {
  23. renderer: 'canvas'
  24. });
  25. var data1 = [];
  26. var data2 = [];
  27. var data3 = [];
  28. for (var i = 0; i < 100; i++) {
  29. data1.push([Math.random() * 5, Math.random() * 360]);
  30. data2.push([Math.random() * 5, Math.random() * 360]);
  31. data3.push([Math.random() * 10, Math.random() * 360]);
  32. }
  33. chart.setOption({
  34. legend: {
  35. data: ['scatter', 'scatter2', 'scatter3']
  36. },
  37. polar: {
  38. },
  39. angleAxis: {
  40. type: 'value'
  41. },
  42. radiusAxis: {
  43. axisAngle: 0
  44. },
  45. series: [{
  46. coordinateSystem: 'polar',
  47. name: 'scatter',
  48. type: 'scatter',
  49. symbolSize: 10,
  50. data: data1
  51. }, {
  52. coordinateSystem: 'polar',
  53. name: 'scatter2',
  54. type: 'scatter',
  55. symbolSize: 10,
  56. data: data2
  57. }, {
  58. coordinateSystem: 'polar',
  59. name: 'scatter3',
  60. type: 'scatter',
  61. symbolSize: 10,
  62. data: data3
  63. }]
  64. });
  65. })
  66. </script>
  67. </body>
  68. </html>