i am creating a line chart which have x-axis as time scale axis and i have to parse the date data coming from backed.
The date is coming in this format from the backend -> 2016-01-14T02:55:55.000Z
I wrote this parse function using d3 date format
var parseDate = d3.time.format("%Y-%m-%dT%H:%M:%S.%L");
But this piece of code not able to parse the above mentioned date format and i have to remove Z
from the x-axis date data which is takes time when there are huge number of data points.
So, is there a way to handle the above mentioned date format in d3?
You need to specify the Z
in the format string:
var parseDate = d3.time.format("%Y-%m-%dT%H:%M:%S.%LZ");
I would recommend using var parseDate = d3.time.format.iso;
instead, as this is more forgiving .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.