ElementStacks

by AbhishekRohan

HTML

<script src="http://highcharts.com/js/testing.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 300px"></div>

JavaScript

var chart = new Highcharts.Chart({

    chart: {
        renderTo: 'container'
    },

    legend: {
        width: 200,
        itemWidth: 100
    },
    plotOptions: {
        series: {
            events: {
                legendItemClick: function(event) {
                    var thisSeriesName = this.name;
                    var thisSeriesVisibility = this.visible ? true : false;
                    $(chart.series).each(function(i, e) {
                        if (thisSeriesName === e.name) {
                            thisSeriesVisibility ? e.hide() : e.show();
                        }
                    });
                    event.preventDefault();
                }
            }
        }
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    series: [{
        type: 'spline',
        showInLegend: false,
        color: 'red',
        name: 'first',
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]},
    {
        data: [null],
        name: 'first',
        type: 'scatter',
        color: 'red',
        marker: {
            symbol: 'triangle-down'
        }},
    {
        type: 'area',
        name: 'third',
        color: 'rgba(0,245,0,0.6)',
        data: [95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1],
        marker: {
            enabled: false
        }},
    {
        data: [null],
        name: 'second',
        type: 'scatter',
        color: 'blue',
        marker: {
            symbol: 'triangle-down'
        }},
    {
        type: 'spline',
        name: 'second',
        data: [71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 1],
        marker: {
            enabled: false
        },
        showInLegend: false,
        color: 'blue'},
    {
        type: 'area',
        name: 'fourth',
        color: 'rgba(12,12,12,0.6)',
        data: [5, 6, 71, 2,...