Highcharts Stock Demo

author(s): Torstein Hønsi

by arjunasuresh3

HTML

<div id="container" style="height: 400px; min-width: 320px; max-width: 600px; margin: 0 auto"></div>

<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'column',
        //marginLeft: 150,
        events: {
            load: function () {

                // set up the updating of the chart each second
                var series = this.series[0];
                debugger;
                setInterval(function () {
                    series.addPoint(["Adapt chart height to legend height" + (new Date()).getTime(), 278], false, false);
                }, 1000);
            }
        }
        //inverted: true
    },
    title: {
        text: 'Most popular ideas by April 2016'
    },
    subtitle: {
        text: 'Source: <a href="https://highcharts.uservoice.com/forums/55896-highcharts-javascript-api">UserVoice</a>'
    },
    xAxis: {
        type: 'category',
        title: {
            text: null
        },
        min: 0,
        max: 3,
        scrollbar: {
            enabled: true
        },
       // tickLength: 0
    },
    yAxis: {
       // min: 0,
       // max: 1000,
        title: {
            text: 'Votes',
            align: 'high'
        }
    },
    //plotOptions: {
      //  column: {
        //    dataLabels: {
          //      enabled: true
            //}
        //}
    //},
    legend: {
        enabled: false
    },
    credits: {
        enabled: false
    },
    series: [{
        name: 'Votes',
        data: [
            ["Gantt chart", 1000],
            ["Autocalculation and plotting of trend lines", 575],
            ["Allow navigator to have multiple data series", 523],
            ["Implement dynamic font size", 427]
        ]
    }]
});