飞道的博客

G6: A Graph Visualization Framework in JavaScript

292人阅读  评论(0)

G6: A Graph Visualization Framework in JavaScript.

https://github.com/antvis/G6

What is G6

G6 is a graph visualization engine, which provides a set of basic mechanisms, including rendering, layout, analysis, interaction, animation, and other auxiliary tools. G6 aims to simplify the relationships, and help people to obtain the insight of relational data.

Features

  • Abundant Built-in Items: Nodes and edges with free configurations;
  • Steerable Interactions: More than 10 basic interaction behaviors ;
  • Powerful Layout: More than 10 layout algorithms;
  • Convenient Components: Outstanding ability and performance;
  • Friendly User Experience: Complete documents for different levels of user requirements. TypeScript supported.

G6 concentrates on the principle of 'good by default'. In addition, the custom mechanism of the item, interation behavior, and layout satisfies the customazation requirements.

Installation

$ npm install @antv/g6

Usage


  
  1. import G6 from '@antv/g6';
  2. const data = {
  3. nodes: [
  4. {
  5. id: 'node1',
  6. label: 'Circle1',
  7. x: 150,
  8. y: 150
  9. },
  10. {
  11. id: 'node2',
  12. label: 'Circle2',
  13. x: 400,
  14. y: 150
  15. }
  16. ],
  17. edges: [
  18. {
  19. source: 'node1',
  20. target: 'node2'
  21. }
  22. ]
  23. };
  24. const graph = new G6.Graph({
  25. container: 'container',
  26. width: 500,
  27. height: 500,
  28. defaultNode: {
  29. shape: 'circle',
  30. size: [ 100 ],
  31. color: '#5B8FF9',
  32. style: {
  33. fill: '#9EC9FF',
  34. lineWidth: 3
  35. },
  36. labelCfg: {
  37. style: {
  38. fill: '#fff',
  39. fontSize: 20
  40. }
  41. }
  42. },
  43. defaultEdge: {
  44. style: {
  45. stroke: '#e2e2e2'
  46. }
  47. }
  48. });
  49. graph.data(data);
  50. graph.render();

For more information of the usage, please refer to Getting Started.

Development


  
  1. $ npm install
  2. # run test case
  3. $ npm run test-live
  4. # build watching file changes and run demos
  5. $ npm run dev

Documents

基于 G6 的图分析应用

https://g6.antv.vision/zh/docs/manual/cases/relations

图标决策

https://g6.antv.vision/zh/examples/case/decisionBubbles


转载:https://blog.csdn.net/universsky2015/article/details/103816981
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场