I have some log file data that I would like to graph. For one log file, every time an event happens a line is added to the log file. I can get it so that the data looks like this:
data = [
{
"click": true,
"date": "2013-06-23T14:37:27.000Z"
},
{
"click": true,
"date": "2013-06-23T14:36:02.000Z"
},
...
...
...
]
Now, what I would like to do is view this data on a time line, so I can see how many clicks happen over time. However, I think I need to group this data by intervals (1 minute or 15 minute, day...) so that I can see how many people are clicking over a period of time. Then graph the interval data.
Is there a way to group data by time interval? Does d3 have a way to do this? I am also using rickshaw and coffeescript.
As suggested by Adam Pearce, you can get all information here: http://bl.ocks.org/mbostock/3048166
The first step is to define
x
:Then, you just define the number of ticks you want:
With
values
being defined like this:So, the secret is behind the
d3.layout.histogram().bins
and theaxis.ticks
calls.