HighCharts Evaluation

Evaluating the HighCharts codebase. http://www.highcharts.com

by Troy Alford

HTML

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

<div id="wrapper">
 <div id="container">
  Pre-Chart Text
 </div>
</div>

SCSS

#wrapper {
    display: block;
    height: 200px;
    width: auto;
    margin: 15px; padding: 10px;
    border-radius: 10px;
    border: 1px solid #666;
    
    #container {
        display: block;
        height: 100%;

        svg text[text-anchor=end] { display: none }
    }
}

JavaScript

$(function () {
    var chart;
    
    $(document).ready(function() {
        
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: true
            },
            title: {
                text: 'This is my test chart!'
            },
            tooltip: {
                formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ this.percentage + ' $';
                }
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: false
                    },
                    showInLegend: true
                }
            },
            series: [{
                type: 'pie',
                name: 'Test Pie!',
                data: [
                    ['Group 1', 45.0],
                    ['Group 2', 20.3],
                    ['Group 3', 18.6],
                    {
                        name: 'My Group', 
                        y: 16.1,
                        sliced: true,
                        selected: true
                    }
                ]
            }]
        });
    });
});