tree-vertical.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <html>
  2. <head>
  3. <meta charset="utf-8" />
  4. <meta name="viewport" content="width=device-width, initial-scale=1" />
  5. <script src="lib/esl.js"></script>
  6. <script src="lib/config.js"></script>
  7. <script src="lib/jquery.min.js"></script>
  8. </head>
  9. <body>
  10. <style>
  11. html, body, #main {
  12. width: 100%;
  13. padding: 0;
  14. margin: 0;
  15. height: 100%;
  16. }
  17. </style>
  18. <div id="main"></div>
  19. <script>
  20. require([
  21. 'echarts'
  22. // 'echarts/chart/tree',
  23. // 'echarts/component/tooltip'
  24. ], function (echarts) {
  25. var chart = echarts.init(document.getElementById('main'), null, {
  26. });
  27. window.onresize = function () {
  28. chart.resize();
  29. };
  30. $.getJSON('./data/flare.json')
  31. .done(function (data) {
  32. chart.setOption({
  33. tooltip: {
  34. trigger: 'item',
  35. triggerOn: 'mousemove'
  36. },
  37. series:[
  38. {
  39. type: 'tree',
  40. data: [data],
  41. left: '2%',
  42. right: '2%',
  43. top: '8%',
  44. bottom: '20%',
  45. symbol: 'emptyCircle',
  46. orient: 'vertical',
  47. expandAndCollapse: true,
  48. label: {
  49. normal: {
  50. position: 'top',
  51. rotate: -90,
  52. verticalAlign: 'middle',
  53. align: 'right'
  54. }
  55. },
  56. leaves: {
  57. label: {
  58. normal: {
  59. position: 'bottom',
  60. rotate: -90,
  61. verticalAlign: 'middle',
  62. align: 'left'
  63. }
  64. }
  65. },
  66. animationDurationUpdate: 750
  67. }
  68. ]
  69. });
  70. });
  71. });
  72. </script>
  73. </body>
  74. </html>