Elena
Elena

Reputation: 71

Highcharts line chart from a Google spreadsheet

I have a Google spreadsheet with two columns:

The sample spreadsheet is public and everyone can modify it:

https://docs.google.com/spreadsheets/d/1-W2c443tuaBTrE5aMOlBckAjHB-jIS2KLlB83EH8Zc0

I created a simple Highchart chart in this way:

$('#chart').highcharts({
    chart: {
        type: 'spline'
    },
    title: {
        text: 'Temperature Log'
    },
    xAxis: {
        text: 'Time',
        type: 'datetime'
    },
    yAxis: {
        title: {
            text: 'Temperature'
        }
    },        
    data: {
         googleSpreadsheetKey: '1-W2c443tuaBTrE5aMOlBckAjHB-jIS2KLlB83EH8Zc0'
    }       
});

The chart works well and you can see here:

https://jsfiddle.net/itzuki87/f474dhuy/3/

The problem is that the x-axis doesn't render properly the datetime format, it start from 1 Jan 1970. Which is the correct format that I have to use? Do I have to change the spreadsheet or the script?

Thank you.

Upvotes: 0

Views: 198

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

Convert your dates into format: YYYY-MM-DD HH:MM:SS

Upvotes: 1

Related Questions