highcharts testing

free responsive pie chart system

by toubia95

HTML

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

<div id="container"></div>

CSS

/* doc: http://api.highcharts.com/highcharts */

#container {
    min-width: 200px; 
    height: 400px; 
    margin: 0 auto;
}

JavaScript

$(function () {
        $('#container').highcharts({
            chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            title: {
                text: 'R\épartition des emplois par secteur d\'activit\é, 2012'
            },
            tooltip: {
        	    pointFormat: '<b>{point.percentage}%</b>',
            	percentageDecimals: 1
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true,
                        color: '#000000',
                        connectorColor: '#000000',
                        formatter: function() {
                            return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
                        }
                    }
                }
            },
            series: [{
                type: 'pie',
                name: 'Pourcentage',
                data: [
                    {
                        name: 'G\éotechnique et G\énie Civil',
                        y: 33,
                        sliced: true,
                        selected: true
                    },
                    ['Mati\ères premi\ères \énergetiques et G\éologie num\érique', 21],
                    ['Recherche', 20],
                    ['Mati\ères premi\ères min\érales', 16],
                    ['Eau et environnement', 10]
                ]
            }]
        });
    });