It is currently Mon Jun 25, 2018 7:40 pm 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: 740
Joined: Mon Oct 02, 2017 5:12 pm

Return to Highstock Usage

Who is online

Users browsing this forum: Bing [Bot] and 2 guests