Highcharts Stock Demo

author(s): Torstein Hønsi

HTML

<div id="container" style="height: 400px; min-width: 600px"></div>

<script src="http://code.highcharts.com/stock/highstock.src.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<script type="text/javascript" src="http://www.highcharts.com/samples/data/three-series-1000-points.js"></script>

JavaScript

$(function() {
    function redrawLegend() {
        $(this.series).each(function(i, e) {
            alert(e.name);
            if (e.legendLine && e.visible) { //for line and spline series
                e.legendLine.attr({
                    stroke: 'red'
                });
            };
            if (e.legendSymbol && e.visible) { //for column and area series
                e.legendSymbol.attr({
                    'fill': 'red',
                    'height': 9,
                    'width': 9
                });
                e.legendItem.attr({
                    text: 'bouh'
                });
                e.legendStyle.attr({
                    'font-size': '12px'
                });
            };
        });
    }
    var chart = new Highcharts.StockChart({

        chart: {
            renderTo: 'container',
            events: {
                load: redrawLegend,
                redraw: redrawLegend
            }
        },

        navigator: {
            top: 295
        },

        legend: {
            enabled: true
        },

        rangeSelector: {
            selected: 1
        },

        series: [{
            name: 'ADBE',
            type: 'area',
            data: ADBE},
        {
            name: 'MSFT',
            data: MSFT}]
    });
});