milan
milan

Reputation: 11

Highchart - Set Time(Hour:Minute) on X axis

I did not able to get labels like [12:00,12:15,12:30,12:45,01:00,01:15,..] on X axis. I got only 00:00 on X axis.I was not able to display increasing time values on X axes. I want to start default from 12:00.

I used following code.

xAxis: { type: 'datetime', tickInterval : 1.5 * 3600 * 1000, dateTimeLabelFormats : { day : '%H:%M' } }

Upvotes: 1

Views: 3444

Answers (2)

SPandya
SPandya

Reputation: 1209

This worked for me in Dynamic Highchart.

    $(document).ready(function () {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                defaultSeriesType: 'spline',
                events: {
                    load: requestData
                }
            },
            title: {
                text: 'Sensor Data Vs. Time'
            },
            xAxis: {
                type: 'datetime',
                tickPixelInterval: 150,
                maxZoom: 20 * 1000
            },
            yAxis: {
                minPadding: 0.2,
                maxPadding: 0.2,
                title: {
                    text: 'Value',
                    margin: 80
                }
            },

            series: [{
               name: 'Sensor Data',
                data: []
            }]
});
});

With this I am displaying Hours, Minutes and seconds as well.

Upvotes: 1

SteveP
SteveP

Reputation: 19093

You haven't shown us what data you are supplying. Something like this works:

        series: [{
            name: 'Temperatures',
            pointStart: new Date().getTime(),
            pointInterval: 24 * 3600 * 1000, 
            data: [1.5 * 60 * 1000,1.2 * 60 * 1000,2.5 * 60 * 1000,1.9 * 60 * 1000,],
        }]

http://jsfiddle.net/Fusher/pQ5EC/12/

Upvotes: 0

Related Questions