A network graph shows relationships as nodes (points) connected by edges (lines), revealing clusters, hierarchies and key influencers that are hard to see in a table. The nodes arrange themselves so that closely connected items end up near each other, and readers can drag them around to explore how everything is linked. This post covers the key components of a network graph and how to create one with Highcharts.
With Highcharts for React, developers get first-class charting with hooks, TypeScript support, and optimized rendering out of the box. Highcharts also integrates with Angular, Vue, and Svelte, as well as server-side languages like Python, R, PHP, and Java, and mobile platforms including iOS and Android.
To explore Highcharts further, visit the interactive demo gallery to see real-world examples, or consult the comprehensive documentation. You can also review the full API reference or learn more about Highcharts products and features.
What are the key components of a network graph?
Network graphs combine several key components to create powerful data visualizations:
- Nodes: Individual entities that can represent anything from people to concepts, with customizable properties like size and color
- Edges: Connections showing relationships or interactions between nodes, with configurable styling options
- Force-directed layout: Physics-based algorithms that position nodes optimally using friction and integration parameters
- Interactive features: Tools for exploring and analyzing relationships through dragging, zooming, and tooltips
How do I create a network graph with Highcharts?
Let’s explore how to create this interactive network graph that maps the Indo-European language family tree.
This example demonstrates how to visualize complex hierarchical relationships, showing the evolution and connections between different language groups.
Step 1: Load the required files and create a container
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/networkgraph.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">
This force directed graph shows an example of a network graph, where
the nodes represent languages and the language families they belong to.
The nodes can be dragged around and will be repositioned dynamically.
</p>
</figure>
Step 2: Add some CSS to control the dimensions and styling
.highcharts-figure {
min-width: 320px;
max-width: 800px;
margin: 1em auto;
}
.highcharts-description {
margin: 0.3rem 10px;
}
Step 3: Implement the JavaScript
Highcharts.addEvent(
Highcharts.Series,
'afterSetOptions',
function (e) {
const colors = Highcharts.getOptions().colors,
nodes = {};
let i = 0;
if (
this instanceof Highcharts.Series.types.networkgraph &&
e.options.id === 'lang-tree'
) {
e.options.data.forEach(function (link) {
if (link[0] === 'Proto Indo-European') {
nodes['Proto Indo-European'] = {
id: 'Proto Indo-European',
marker: {
radius: 20
}
};
nodes[link[1]] = {
id: link[1],
marker: {
radius: 10
},
color: colors[i++]
};
} else if (nodes[link[0]] && nodes[link[0]].color) {
nodes[link[1]] = {
id: link[1],
color: nodes[link[0]].color
};
}
});
e.options.nodes = Object.keys(nodes).map(function (id) {
return nodes[id];
});
}
}
);
Highcharts.chart('container', {
chart: {
type: 'networkgraph',
height: '100%'
},
title: {
text: 'The Indo-European Language Tree',
align: 'left'
},
subtitle: {
text: 'A Force-Directed Network Graph in Highcharts',
align: 'left'
},
plotOptions: {
networkgraph: {
keys: ['from', 'to'],
layoutAlgorithm: {
enableSimulation: true,
friction: -0.9
}
}
},
series: [{
accessibility: {
enabled: false
},
dataLabels: {
enabled: true,
linkFormat: '',
style: {
fontSize: '0.8em',
fontWeight: 'normal'
}
},
id: 'lang-tree',
data: [
['Proto Indo-European', 'Balto-Slavic'],
['Proto Indo-European', 'Germanic'],
['Proto Indo-European', 'Celtic'],
['Proto Indo-European', 'Italic'],
['Proto Indo-European', 'Hellenic'],
['Proto Indo-European', 'Anatolian'],
['Proto Indo-European', 'Indo-Iranian'],
['Proto Indo-European', 'Tocharian'],
// Additional language relationships...
]
}]
});
What features does the language tree example use?
The implementation includes several sophisticated features to enhance the visualization:
- Dynamic node sizing: Root nodes are larger (radius: 20px) than child nodes (radius: 10px) to emphasize hierarchy
- Color inheritance: Child nodes inherit colors from their parents, creating visual groupings
- Layout algorithm: Custom friction settings (-0.9) for optimal node distribution
- Accessibility features: Built-in support for screen readers and keyboard navigation
How is the network graph data structured?
The language tree example demonstrates effective data organization for complex hierarchical relationships. The data structure uses parent-child relationships to build the network, with special handling for root nodes and their descendants. This approach allows for clear visualization of both direct relationships and broader language family groupings.
Key features of the data structure include:
- Hierarchical organization: Clear parent-child relationships between language groups
- Visual differentiation: Distinct styling for different levels of the hierarchy
- Consistent formatting: Standardized data format for easy maintenance and updates
How do the layout settings affect network graph behavior?
The implementation includes several performance optimizations for smooth interaction with large datasets. The force-directed layout algorithm is carefully tuned with custom friction settings to achieve optimal node distribution while maintaining good performance. The enableSimulation option allows for dynamic repositioning, while controlled node sizing prevents overcrowding in the visualization.
Conclusion
Network graph visualization in Highcharts provides a powerful way to map and understand complex relationships. Through careful implementation of node styling, layout algorithms, and interactive features, you can create compelling visualizations that help users explore and understand complex hierarchical data. Whether you’re mapping language families, organizational structures, or any other relationship-based data, network graphs offer an intuitive and effective way to communicate complex connections.
Frequently asked questions
What is a network graph?
A network graph represents relationships through nodes (points) and edges (connecting lines). Analysts use it to find key influencers, identify clusters and follow the flow of information or resources through a system.
Which files do I need to create a network graph in Highcharts?
Load highcharts.js and modules/networkgraph.js from code.highcharts.com. The example in this post also loads exporting.js and accessibility.js and uses a div with the id ‘container’ as the chart container.
How do I define the data for a network graph?
Set chart.type to ‘networkgraph’, declare keys: [‘from’, ‘to’] in plotOptions.networkgraph, and pass the series data as [from, to] pairs such as [‘Proto Indo-European’, ‘Germanic’].
How do I let users drag nodes and have the layout update?
Set plotOptions.networkgraph.layoutAlgorithm.enableSimulation to true. In the example, nodes can be dragged around and are repositioned dynamically.
How do I set different node sizes and colors?
Build a nodes array in an afterSetOptions event handler. The example gives the root node a marker radius of 20, gives its direct children a radius of 10 and a color from Highcharts.getOptions().colors, and lets deeper nodes inherit their parent’s color.
Resources
- Documentation – Getting started with Highcharts
- Documentation – Network graph
- Demo/example section
- Highcharts® Core product page
Related posts
- Real-time data visualization using Highcharts
- Big data visualization using Highcharts
- Climate data visualization using Highcharts
- Heat map examples using Highcharts
- Polygon chart using Highcharts
- Intraday chart examples using Highcharts









Leave a Reply