Drawing a simple chart is easily done--only the value attribute is required:
<p-organizationChart [value]="data"></p-organizationChart>
In the component class, we need to create an array of nested TreeNode instances. In the simple use case, providing labels is enough:
data: TreeNode[];
ngOnInit() {
this.data = [
{
label: 'CEO',
expanded: true,
children: [
{
label: 'Finance',
expanded: true,
children: [
{label: 'Chief Accountant'},
{label: 'Junior Accountant'}
]
},
{label: 'Marketing'},
{
label: 'Project Manager',
expanded: true,
children: [
{label: 'Architect'},
{label: 'Frontend Developer'},
{label: 'Backend Developer'}
]
}
]
}
];
}
By default, tree...