Highcharts Demo

author(s): Torstein Hønsi

HTML

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

<div id="container" style="height: 400px"></div>

JavaScript

$(function () {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo:'container',
            events:{
                redraw: function(){
                    var svgSeriesParent = document.querySelectorAll('.highcharts-series')[0];
                    var pathArray = document.querySelectorAll('path');
                    
                    for (var pathIndex = 0; pathIndex < pathArray.length; pathIndex++) {
                        var pathObj = pathArray[pathIndex];
                        //if attribute fill is not "none", this is an area path.
                        if ($(pathObj).attr('fill') !== "none") {
                            svgSeriesParent.insertBefore(pathObj, svgSeriesParent.firstChild);
                        }

                    }
                }
            }
        },
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },
        
        plotOptions: {
            series: {
                cursor: 'pointer',
                point: {
                    events: {
                        click: function() {
                            alert ('Category: '+ this.category +', value: '+ this.y);
                        }
                    }
                }
            }
        },
        
        series: [{
            type:'area',
            data: [39.9, 75.5, 120.4, 150.2, 130.0, 120.0, 140.6, 158.5, 216.4, 194.1, 220.6, 230.4]},
                 {
                     type:'area',
            data: [250.9, 240.5, 230.4, 220.2, 200.0, 180.0, 160.6, 140.5, 110.4, 100.1, 75.6, 20.4]        
        }
        
        ]
    });
    
    chart.redraw();
    
});