I would like to create a zoomable time series chart of the number of Tweets that an an account posted per day. My server returns data for the dates where Tweets occurred, that looks like this:
[
"2009-01-12", 3
], [
"2009-01-15", 1
], [
"2009-01-16", 1
], [
"2009-01-30", 2
]
I know that the ISO 8601 date can be converted with Date.parsedate()
. Can I register it as a callback to convert the dates? How can I create a zoomable chart with irrigular intervals?
You just need to loop through your array and parse that date to get timestamp, for example:
var parsedDate = [];
for(var i = 0; i < your_array.length; i++){
var t = your_array[i],
d = (new Date(t[0])).getTime();
parsedData.push([d, t[1]]);
}
And then assign to series data in options:
series: [{
data: parsedData;
}]
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.