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',
            type: 'spline'
        },
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },

        plotOptions: {
            series: {
                events: {
                    legendItemClick: function(event) {
                        event.preventDefault();
                        $(chart.series).each(function(i, e) {
                                this.visible? e.hide() : e.show();
                        });
                    }
                }
            }
        },

        series: [{
            name: 'Custom name',
            data: [29.9, 1, 1, 1, 144.0, 1, 135.6, 148.5, 216.4],
            color: 'red',
            marker: {
                symbol: 'circle'
            }},
        {
            showInLegend: false,
            color: 'grey',
            marker: {
                symbol: 'circle'
            },
            data: [[8,216.4], [9, 10], [10, 25], [11, 55]],
            dashStyle: 'dash'
        },
        {
            showInLegend: false,
            color: 'grey',
            marker: {
                symbol: 'circle'
            },
            data: [[8,216.4], [9, 210]],
            dashStyle: 'dash'
 
        }]
    });
});