It is currently Wed Jan 17, 2018 5:09 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: http://www.php.net/manual/en/function.strftime.php

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


Live demo: http://jsfiddle.net/ppotaczek/omLan4c0/
API Reference: https://api.highcharts.com/class-refere ... dateFormat

Best regards!
Paweł Potaczek,
Highcharts Developer
ppotaczek
 
Posts: 258
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