What problem does it solve?
DagreGraph components simplify building directed graphs with automatic hierarchical layouts, enabling developers to render organizational charts, dependency trees, flowcharts, and decision trees without manual positioning.
Core Features & Use Cases
- Hierarchical layout: automatic ranking and edge routing for TB, LR, and other directions.
- Custom visuals: control node color, size, shape, and label accessors.
- Interactivity: respond to node and link events and apply dagreSettings for layout tweaks.
- Use Case: visualize a company org chart with levels and reporting lines using a single data structure.
Quick Start
Import DagreGraph from vue-chrts and render with a data object:
import { DagreGraph } from 'vue-chrts';
const graphData = {
nodes: [
{ id: 'ceo', label: 'CEO', level: 0 },
{ id: 'mgr', label: 'Manager', level: 1 }
],
links: [
{ source: 'ceo', target: 'mgr' }
]
};
// In your component template
<DagreGraph :data="graphData" :dagreSettings="{ rankdir: 'TB', nodesep: 60, ranksep: 80 }" />