Grouped categories demo

author(s): Black Label

by Arvind Pal

HTML

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

CSS

body {
    padding: 0px !important;
    margin: 8px;
}

JavaScript

$(function () {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: "container",
            type: "column",
            borderWidth: 5,
            borderColor: '#e8eaeb',
            borderRadius: 0,
            backgroundColor: '#f7f7f7'
        },
        title: {
            style: {
                'fontSize': '1em'
            },
            useHTML: true,
            x: -27,
            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: [{
            data: [4, 14, 18, 5, 6, 5, 14, 15, 18]
        }],
        xAxis: {
            categories: [{
                name: "Tree",
                categories: [{
					name:"Fruit",
					categories:[{name:"Apple"},"Banana","Orange"]
				}, {
                name: "Vegetable",
                categories: ["Carrot", "Potato", "Tomato"]
            }]
            }, {
                name: "Fish",
                categories: ["Cod", "Salmon", "Tuna"]
            }]
        }
    });
});