Highcharts column example

by BluePampa

HTML

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

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

JavaScript

var s = '[{"name":"Activité","data":[{"name":"Societe Dispatcher","y":40.2},{"name":"SPAC BRETAGNE","y":20},{"name":"SEGEC","y":52.3}]},{"name":"Arrêt","data":[{"name":"Societe Dispatcher","y":13.2},{"name":"SPAC BRETAGNE","y":40.9},{"name":"SEGEC","y":100.4}]},{"name":"Entretien","data":[{"name":"Societe Dispatcher","y":2.5},{"name":"SPAC BRETAGNE","y":0},{"name":"SEGEC","y":10}]},{"name":"Panne","data":[{"name":"Societe Dispatcher","y":10.2},{"name":"SPAC BRETAGNE","y":0},{"name":"SEGEC","y":3.7}]},{"name":"Intempérie","data":[{"name":"Societe Dispatcher","y":0},{"name":"SPAC BRETAGNE","y":0},{"name":"SEGEC","y":0}]}]';

s = JSON.parse(s);
$(function () {
    $('#graph').highcharts({
    credits: {
        text: "Dispatcher",
        href: "#"
    },
    chart: {
        type: "column"
    },
    title: {
        text: "Graph"
    },
    yAxis: {
        title: {
            text: 'Temps (en jours)'
        }
    },                        
    xAxis: {
        type: 'category'
    },
    legend: {
        enabled: true,
        useHTML: true
    },
    plotOptions: {
        series: {
            borderWidth: 0,
            dataLabels: {
                enabled: true,
                zindex : 6,
                formatter: function(){
                    return this.total; 
                }
            },
            stacking: 'normal'
        }
    },       
    tooltip: {
        pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
        shared: true
    },  
    series: s
});
});