Search code examples
javascriptreactjsapexcharts

Is it possible to include minute and seconds data in a time series apex chart?


I am trying to also input the time in seconds along with the date range, how can I do that inside of series? Here is my current code, only showing the date range in days.

series: [
 {
  name: 'Dataset One',
  data: [ 
   {
    x: 'Dataset One',
    y: [
     new Date('2020-01-30').getTime(),
     new Date('2020-02-20').getTime()
    ]
   }
  ]
 }
]

Solution

  • You're almost all the way there ... You just need to add the time to your Date. You can also refer to the Date Constructor on MDN docs.

    new Date('2020-01-30T00:00:00').getTime(),
    new Date('2020-02-20T00:00:00').getTime()
    

    The T is in 24 hour format .. hh:mm:ss