It is currently Tue Mar 20, 2018 1:28 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 3: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 3:18 pm

Re: Convert xAxis in hours

Postby ppotaczek » Fri Jan 12, 2018 5: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: 469
Joined: Mon Oct 02, 2017 4:12 pm

Return to Highstock Usage

Who is online

Users browsing this forum: No registered users and 0 guests