orgchart
Version:
Simple and direct organization chart(tree-like hierarchy) library based on pure DOM.
49 lines (46 loc) • 1.45 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>OrgChart Left to Right Demo</title>
<link rel="icon" href="img/logo.png">
<link rel="stylesheet" href="css/orgchart.css">
<link rel="stylesheet" href="css/style.css">
<style type="text/css">
#chart-container { text-align: left; }
</style>
</head>
<body>
<section class="demo-notes">
<h1>Left to Right Demo</h1>
<p>This demo renders the chart from left to right instead of the default top-to-bottom layout.</p>
</section>
<div id="chart-container"></div>
<script type="text/javascript" src="js/orgchart.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
const datasource = {
'name': 'Lao Lao',
'title': 'general manager',
'children': [
{ 'name': 'Bo Miao', 'title': 'department manager' },
{ 'name': 'Su Miao', 'title': 'department manager',
'children': [
{ 'name': 'Tie Hua', 'title': 'senior engineer' },
{ 'name': 'Hei Hei', 'title': 'senior engineer' }
]
},
{ 'name': 'Hong Miao', 'title': 'department manager' },
{ 'name': 'Chun Miao', 'title': 'department manager' }
]
};
const oc = new OrgChart({
chartContainer: '#chart-container',
'data' : datasource,
'nodeContent': 'title',
'direction': 'l2r'
});
});
</script>
</body>
</html>