Highcharts Tutorial
Chart Types
A stacked group column chart is a chart type that displays data as a series of columns stacked on top of each other, with each column representing a category or data series and the height of the column representing the value of that category or series. In a stacked group column chart, there are multiple groups of columns, where each group represents a data series and the columns within each group represent categories. Highcharts supports stacked group column charts using the chart.type
option set to 'column'
, the plotOptions.column.grouping
option disabled, and the plotOptions.column.stacking
option enabled.
To create a stacked group column chart using Highcharts, you can follow these steps:
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="chart-container"></div>
Highcharts.chart('chart-container', { chart: { type: 'column' }, title: { text: 'Stacked Group Column Chart' }, xAxis: { categories: ['Category 1', 'Category 2', 'Category 3', 'Category 4', 'Category 5'] }, yAxis: { title: { text: 'Y Axis Label' } }, plotOptions: { column: { grouping: false, stacking: 'normal' } }, series: [{ name: 'Series 1', data: [10, 20, 30, 40, 50], stack: 'Group 1' }, { name: 'Series 2', data: [20, 30, 40, 50, 60], stack: 'Group 1' }, { name: 'Series 3', data: [30, 40, 50, 60, 70], stack: 'Group 2' }, { name: 'Series 4', data: [40, 50, 60, 70, 80], stack: 'Group 2' }] });
In this example, we're creating a stacked group column chart with the Highcharts chart
function and passing in a set of options:
chart.type
is set to 'column'
to create a column charttitle.text
is set to 'Stacked Group Column Chart'
to set the main titlexAxis.categories
is set to an array of category labels for the x-axisyAxis.title
is used to set the label for the y-axisplotOptions.column.grouping
is set to false
to disable grouping of columns within each categoryplotOptions.column.stacking
is set to 'normal'
to enable stacking of columnsseries
is set to an array of objects with a name
, data
, and stack
property to define the series data. The data
property contains an array of values for each category, which are displayed as stacked columns. The stack
property is used to group the columns within each series.With these options, you can create a stacked group column chart with customizable data and appearance.
Customizing appearance in Highcharts Stacked Group Column Chart:
Highcharts.chart('container', { chart: { type: 'column' }, plotOptions: { column: { color: '#FFA07A', // Set column color borderColor: 'black', // Set border color borderWidth: 2 // Set border width } }, // Other configuration options... });
Adding data to Highcharts Stacked Group Column Chart:
series
array to create a stacked group chart.Highcharts.chart('container', { series: [{ name: 'Group 1', data: [5, 3, 4, 7, 2] }, { name: 'Group 2', data: [2, 4, 1, 3, 5] }], // Other configuration options... });
Interactive features in Highcharts Stacked Group Column Chart:
Highcharts.chart('container', { tooltip: { shared: true, // Enable shared tooltip // Other tooltip options... }, // Other configuration options... });
Handling multiple series in Highcharts Stacked Group Column Chart:
series
array.Highcharts.chart('container', { series: [{ name: 'Group 1', data: [1, 2, 3] }, { name: 'Group 2', data: [4, 5, 6] }], // Other configuration options... });
Grouped Stacked Group Column Chart in Highcharts:
stacking
option within the plotOptions
.Highcharts.chart('container', { chart: { type: 'column' }, plotOptions: { column: { stacking: 'normal' // 'normal' for grouped stacking } }, // Other configuration options... });