Example of techan.js using ISO 8061 date format with hours

514 views Asked by At

Does anyone have an example of a TechanJS H1, hourly chart (http://techanjs.org/) that uses the ISO 8061 date standard?

Thanks

2

There are 2 answers

0
thomas.han On

If you have a look into test/spec/bundle/_util/date.js (v.0.6.0-6) there should be a function called parseIso8601.

I wrote it myself :)

0
Garth On

Figured it out: Use the following techan formats:

// JavaScript
var parseDate = d3.time.format("%Y-%m-%dT%H:%M:%S").parse,
      timeFormat = d3.time.format('%Y-%m-%dT%H:%M:%S'),
      valueFormat = d3.format(',.5fs');      

Use the following date format (note exactly ISO but it's what C# Json WebAPI's outputting which is what I'm after):

// C#
DateTime.ToString("yyyy-MM-ddTHH:mm:ss")
// 2015-08-24T17:00:00