It is currently Wed Sep 26, 2018 3:53 am Advanced search

Convert xAxis in hours

Technical support for the Highcharts Stock package

Convert xAxis in hours

Postby Seba Garcia » Fri Jan 12, 2018 4:44 pm

Hi. I have a graph that has time as the x axis. And when doing chart.xAxis [0] .min to find the minimum of the graph it returns me: min: 1515758333980.
How do I turn this into time?
Seba Garcia
Posts: 1
Joined: Fri Jan 12, 2018 4:18 pm

Re: Convert xAxis in hours

Postby ppotaczek » Fri Jan 12, 2018 6:26 pm

Hi Seba Garcia,

Use Highcharts dateFormat method. Useful format parameters:

Code: Select all
      load: function() {
        let time = this.xAxis[0].min
        let convertedTime = Highcharts.dateFormat('%b %e %H:%M', time)

Live demo:
API Reference: ... dateFormat

Best regards!
Paweł Potaczek,
Highcharts Developer
Posts: 743
Joined: Mon Oct 02, 2017 5:12 pm

Return to Highstock Usage

Who is online

Users browsing this forum: No registered users and 1 guest