Grouped categories demo

author(s): Black Label

by Geo George

HTML

<script src="https://blacklabel.github.io/grouped_categories/grouped-categories.js"></script>
<link rel="stylesheet" href="https://blacklabel.github.io/grouped_categories/css/styles.css">
<script src="https://code.highcharts.com/js/highcharts.js"></script>
<div id="container" class="chart-container"></div>

JavaScript

$(function () {

    var chart = new Highcharts.Chart({
        chart: {
            renderTo: "container",
            type: "column"
        },
        title: {
            useHTML: true,
            x: -10,
            y: 8,
            text: '<span class="chart-title"> Grouped categories <span class="chart-href"> <a href="http://www.blacklabel.pl/highcharts" target="_blank"> Black Label </a> </span> <span class="chart-subtitle">plugin by </span></span>'
        },
        series: [{
            name : "dd",
            data: [4, 14, 18, 5, 6, 5, 14, 15, 18]
        },
        {
            name : "www",
            data: [4, 14, 18, 5, 6, 5, 14, 15, 18]
        }],
         plotOptions: {
         		series:{
            	stacking: 'normal'
            }
         },
        xAxis: {
            tickColor: "transparent",
            categories: [{
                name: "Fruit",
                categories: [{name:"Apple"}, "Banana", "Orange"]
            }, {
                name: "Vegetable",
                categories: ["Carrot", "Potato", "Tomato"]
            }, {
                name: "Fish",
                categories: ["Cod", "Salmon", "Tuna"]
            }]
        }
    });
});