Highcharts Demo

author(s): Torstein Hønsi

by robcampo

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="width: auto;height: 400px"></div>

JavaScript

$(function () {
    Highcharts.setOptions({
        global: {
            useUTC: false
        }
    });

    
    $('#container').highcharts({
        chart: {
            type: 'line'
        },
        xAxis: {
            type: 'datetime',
            tickInterval: 3600 * 1000,
            //min: Date.UTC(2013,4,22),
            //max: Date.UTC(2013,4,23),
            dateTimeLabelFormats: {
                hour: '%l%P'
            },
            startOnTick: true,
            endOnTick: true,
            
            oldlabels: {
                formatter: function () {
                    console.log('formatter this: ', this)
                    
                    return Highcharts.dateFormat('%l%P', this.value);
                    //return this.value;
                }
            }
        },
        yAxis: {
            allowDecimals: false,
            min: 0,
            lineWidth: 1,
            gridLineWidth: 1
        },
        series: [{
            data: [
                [1412751600000, 3],
                [1412758800000, 1]
            ]
        }]
    });
});