webkit-dep.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <script src="esl.js"></script>
  5. <script src="config.js"></script>
  6. <script src="lib/jquery.min.js"></script>
  7. <script src="lib/dat.gui.min.js"></script>
  8. </head>
  9. <body>
  10. <style>
  11. html, body, #main {
  12. width: 100%;
  13. height: 100%;
  14. margin: 0;
  15. }
  16. </style>
  17. <div id="main"></div>
  18. <script>
  19. require([
  20. 'echarts',
  21. 'echarts/chart/graph',
  22. 'echarts/component/title',
  23. 'echarts/component/legend',
  24. 'echarts/component/geo',
  25. 'echarts/component/tooltip',
  26. 'echarts/component/visualMap'
  27. ], function (echarts) {
  28. $.get('data/webkit-dep.json', function (webkitDep) {
  29. var chart = echarts.init(document.getElementById('main'));
  30. chart.setOption({
  31. legend: {
  32. data: ['HTMLElement', 'WebGL', 'SVG', 'CSS', 'Other']
  33. },
  34. series: [{
  35. type: 'graph',
  36. layout: 'force',
  37. animation: false,
  38. label: {
  39. normal: {
  40. position: 'right',
  41. formatter: '{b}'
  42. }
  43. },
  44. draggable: true,
  45. data: webkitDep.nodes.map(function (node, idx) {
  46. node.id = idx;
  47. return node;
  48. }),
  49. categories: webkitDep.categories,
  50. force: {
  51. // initLayout: 'circular'
  52. // gravity: 0
  53. // repulsion: 20,
  54. edgeLength: 5,
  55. repulsion: 20
  56. },
  57. edges: webkitDep.links
  58. }]
  59. });
  60. });
  61. });
  62. </script>
  63. </body>
  64. </html>