WTS - Occupancy Highchart

by Paulo Ávila

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

JavaScript

$(function () {
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'column'
            },
            colors: [
                '#E75113', 
                '#999'
            ],
            title: {
                text: 'Occupancy per month'
            },
            xAxis: {
                categories: ['Mar \'12', 'Apr \'12', 'May \'12', 'Jun \'12', 'Jul \'12']
            },
            yAxis: {
                min: 0,
                max: 100,
                title: {
                    text: 'Percent Occupied'
                }
            },
            tooltip: {
                formatter: function() {
                    return ''+
                        this.series.name +': '+ this.y +'%';
                }
            },
            plotOptions: {
                column: {
                    stacking: 'normal'
                }
            },
                series: [{
                name: 'Waytostay',
                data: [52, 37, 43, 69, 21]
            }, {
                name: 'Blocked',
                data: [24, 21, 30, 27, 11]
            }]
        });
    });
    
});