0

I am constructing JSON data structure in python and passing it to Highcharts.StockChart but I can't seem to figure out what format date/timestamp has to be.

Here is how JSON data looks like:

  {'chart_data': {'dates': ['07/29/14 23:50', '07/29/14 23:45' ], 
                    'values': [ {'data': [59, 72] } ] 
    }

FWIW - I am generating timestamp using this function in python

    myData['dates'].append(r.event_time.strftime('%m/%d/%y %H:%M'))

I also tried to pass dates as 'integers' 'dates': ['1406703000', '1406702700', ] but none of these are producing the right time of timestamps. What exactly is the format of timestamp expected when showing time-series data using highchart?

Subodh Nijsure
  • 3,305
  • 5
  • 26
  • 45
  • 2
    Your answer can be found here: http://stackoverflow.com/questions/10286204/the-right-json-date-format – gview Jul 26 '14 at 04:40

1 Answers1

1

Your datas should be multiplied by 1000, and order ascending. Obviously you can get your json by javascitrp and parse all dates.

Sebastian Bochan
  • 37,348
  • 3
  • 49
  • 75
  • I have data in following format but it still shows me time stamp in 1970? Seconds - 1406851200 Date: 2014-07-31 17:00:00 Seconds - 1406851500 Date: 2014-07-31 17:05:00 { "chart_data": { "dates": [ 1406851200000, 1406851500000, ], "values": [ { "data": [ 54, 60 ] }, { "data": [ 84, 90 ] } ] } } – Subodh Nijsure Aug 02 '14 at 03:52
  • You need to multiple your timestamps by 1000 and dates will be correct – Sebastian Bochan Aug 04 '14 at 11:11