Organization chart
author(s): Torstein Hønsi
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/sankey.js"></script>
<script src="https://code.highcharts.com/modules/organization.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
Organization charts are a common case of hierarchical network charts,
where the parent/child relationships between nodes are visualized.
Highcharts includes a dedicated organization chart type that streamlines
the process of creating these types of visualizations.
</p>
</figure>
CSS
.highcharts-figure,
.highcharts-data-table table {
min-width: 360px;
max-width: 800px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #ebebeb;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
#container h4 {
text-transform: none;
font-size: 14px;
font-weight: normal;
}
#container p {
font-size: 13px;
line-height: 16px;
}
@media screen and (max-width: 600px) {
#container h4 {
font-size: 2.3vw;
line-height: 3vw;
}
#container p {
font-size: 2.3vw;
line-height: 3vw;
}
}
.highcharts-description {
margin: 0.3rem 10px;
}
JavaScript
Highcharts.chart('container', {
chart: {
height: 200,width:400,
inverted: true
},
title: {
text: ' Ledning'
},
accessibility: {
point: {
descriptionFormat: '{add index 1}. {toNode.name}' +
'{#if (ne toNode.name toNode.id)}, {toNode.id}{/if}, ' +
'reports to {fromNode.id}'
}
},
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function() {
location.href = 'http://google.com';
}
}
}
}
},
series: [{
type: 'organization',
name: 'Factory',
keys: ['from', 'to'],
nodes: [
{id: 'AAA', title:'Important person 1', name: 'John Doe',width:120, height:100},
{id: 'BBB', title:'Important person 2', name: 'Jane Doe',width:120, height:100},
{id: 'CCC', title:'Important person 3', name: 'Matt Black',width:120, height:100},
{id: 'DDD', title:'Important person 4', name: 'Millie Liter',width:120, height:100},
{id: 'EEE', title:'Important person 5', name: 'Nick Some',width:120, height:100},
{id: 'FFF', title:'Important person 6', name: 'Wednesday Parker Hutchinson',width:120, height:100},
{id: 'GGG', title:'Important person 7', name: 'Wendy McDonald',width:120, height:100},
{id: 'HHH', title:'Important person 8', name: 'Natalie Porter',width:120, height:100},
{id: 'III', title:'Important person 9', name: 'Sir Donald Ravensburger',width:120, height:100},
{id: 'JJJ', title:'Important person 10', name: 'Mick Dundee',width:120, height:100},
{id: 'KKK', title:'Important person 10', name: 'Nicki Wicki',width:120, height:100},
],
data: [
['KKK','FFF'],
['KKK','JJJ'],
['KKK','BBB'],
['KKK','III'],
['KKK','EEE'],
['KKK','DDD'],
['KKK','CCC'],
['KKK','GGG'],
['KKK','AAA'],
['KKK','HHH'],
],
levels: [{
level: 0,
color: 'silver',
...