Highcharts Stacked Group Column Chart

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:

  • Include the Highcharts library in your HTML file. You can either download it from the Highcharts website or include it from a CDN like this:
<script src="https://code.highcharts.com/highcharts.js"></script>
  • Create a container element for the chart in your HTML file, like this:
<div id="chart-container"></div>
  • In your JavaScript code, create a Highcharts chart object and configure it with the data and chart options. For example:
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 chart
  • title.text is set to 'Stacked Group Column Chart' to set the main title
  • xAxis.categories is set to an array of category labels for the x-axis
  • yAxis.title is used to set the label for the y-axis
  • plotOptions.column.grouping is set to false to disable grouping of columns within each category
  • plotOptions.column.stacking is set to 'normal' to enable stacking of columns
  • series 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.

  1. Customizing appearance in Highcharts Stacked Group Column Chart:

    • Customize appearance by modifying various chart options, such as colors, borders, and tooltips.
    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...
    });
    
  2. Adding data to Highcharts Stacked Group Column Chart:

    • Add data for each series within the 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...
    });
    
  3. Interactive features in Highcharts Stacked Group Column Chart:

    • Enable interactive features like tooltips, data labels, and events for a richer user experience.
    Highcharts.chart('container', {
        tooltip: {
            shared: true, // Enable shared tooltip
            // Other tooltip options...
        },
        // Other configuration options...
    });
    
  4. Handling multiple series in Highcharts Stacked Group Column Chart:

    • Handle multiple series by defining each series within the series array.
    Highcharts.chart('container', {
        series: [{
            name: 'Group 1',
            data: [1, 2, 3]
        }, {
            name: 'Group 2',
            data: [4, 5, 6]
        }],
        // Other configuration options...
    });
    
  5. Grouped Stacked Group Column Chart in Highcharts:

    • Grouped stacking can be achieved by configuring the stacking option within the plotOptions.
    Highcharts.chart('container', {
        chart: {
            type: 'column'
        },
        plotOptions: {
            column: {
                stacking: 'normal' // 'normal' for grouped stacking
            }
        },
        // Other configuration options...
    });