Loading...
The core of G6 charts is composed of three basic elements: Node, Edge, and Combo. These elements are the fundamental units for building complex graphical networks.
Nodes represent entities or concepts in the graph, such as people, places, objects, etc. G6 provides a rich set of built-in node types:
G6 also supports defining nodes using React or custom nodes to meet specific needs.
Edges represent the connections between nodes, such as friendships, transactions, etc. G6 has multiple built-in edge types:
When built-in edges do not meet the requirements, complex connection expressions can be achieved through custom edges.
Combos are special elements that can contain nodes and other combos, used to represent collections, groups, or hierarchical relationships. G6 has two built-in combo types:
circle
): Suitable for compact groupingrect
): Suitable for regular layout groupingCombos support nesting, dragging, expanding/collapsing, and other interactions, and more complex container behaviors can be achieved through custom combos.
Each element is composed of one or more basic shapes. Shapes are the smallest graphical units in G6, including rectangle, circle, text, path, etc.
For example:
For more information about shapes, see Shape Overview and Shape Style Properties.
Element State is a powerful mechanism for displaying visual changes of elements in different interactions or business scenarios. G6 provides a complete state management system:
selected
, highlight
, active
, etc.G6 5.x adopts a flat configuration structure, where all element configurations are at the same level, making it easy to find and manage:
{node: {// Default node stylestyle: {fill: 'orange',labelText: 'node',},// Node styles in different statesstate: {selected: {stroke: '#1890FF',lineWidth: 2,}}},edge: {// Default edge stylestyle: {stroke: '#aaa',},// Edge styles in different statesstate: {highlight: {stroke: 'red',}}},combo: {// Default combo stylestyle: {fill: 'lightblue',stroke: 'blue',}}};
There are three configuration methods, in order of priority from high to low:
graph.setNode()
, graph.setEdge()
, graph.setCombo()
new Graph()
In editors like VSCode, you can see all configurable properties of elements and search based on keywords:
G6 provides powerful extension capabilities to meet various customization needs:
@antv/g6-extension-3d