Highcharts Date/Time and X-Axis

porterhaus

I am looking for a simple example of how to make the time display in one hour increments for a 24 hour period, a la: 8 AM, 9 AM, etc... along the x-axis. The data to be charted will be as follows [time, meter-reading]. All of my attempts to date have not worked.

Please advise if further details need to be provided.

Pierre Fourgeaud

After playing with an official example and the documentation, I found a way to get intervals every two hours but you can get easily intervals every hour.

Here are the options you have to define in your Highcharts creation:

$(function () {
    $('#container').highcharts({
        chart: { ... },
        title: { ... },
        subtitle: { ... },
        xAxis: {
            type: 'datetime',
            tickInterval: 3600 * 1000,
            ...
        },
        yAxis: { ... },
        tooltip: { ... },
        legend: { ... },
        plotOptions: { ... },
        series: [{
            ...
            pointInterval:  3600 * 1000,
            pointStart: Date.UTC(2006, 0, 01, 0, 0, 0, 0),
            data: [
                ...
            ]
        }]
    });
});

Playing with the tickInterval, pointInterval and pointStart options, you can obtain what you want.

Here is a live example of what I am talking about: http://jsfiddle.net/FxD58/1/

It works very well if you have 24 values in series (like the 24 hours in a day...)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

HighCharts scatter plot with Datetime on X Axis not plotting values correctly

From Dev

How to align Highcharts datetime x-axis with data I pass to it?

From Dev

How to align Highcharts datetime x-axis with data I pass to it?

From Dev

HighCharts trouble with the x axis

From Dev

Matplotlib datetime on the x axis

From Dev

Style highcharts x and y axis

From Dev

Highcharts Omits X Axis Label

From Dev

Wrong labels on X axis on Highcharts

From Dev

Wrong labels on X axis on Highcharts

From Dev

X-axis interval in Highcharts

From Dev

Highcharts - show every month on datetime x-axis when the parent container is small

From Dev

How to show all values at datetime axis in highcharts?

From Dev

Is a Highcharts heatmap possible with a datetime axis, in a single row?

From Dev

Highcharts: Make the Axis continue to current datetime

From Dev

R: ggplot with datetime on x axis

From Dev

Highcharts x-axis tick starts with an offset

From Dev

Highcharts tooltip x axis font size

From Dev

Highcharts X-Axis labels as Text

From Dev

How to breaks highcharts x-Axis category

From Dev

HighCharts x-axis label padding

From Dev

Highcharts Line Chart with Only x-axis

From Dev

Highcharts display series.name on X Axis

From Dev

Highcharts Legend Overlaps with X-Axis

From Dev

Highcharts update x-axis categories dynamically

From Dev

Highcharts Date/Time and X-Axis

From Dev

Highcharts Series name on X-Axis

From Dev

Highcharts load date values in X axis

From Dev

HighCharts not plotting decimal values in x-axis

From Dev

HighCharts x-axis label padding