mardi 1 mai 2018

Chart.js - creating time series freqency chart with JSON data

so recently I've been working on a web app that collects data from requests and I am trying to output the data into a graph based on frequency per hour/month etc.

So, I'm using Chart.js and have JSON data of dates and I'm trying to make a chart that shows the frequency of requests per hour, etc.

My data is just each request has a time stamp, so all I have is a bunch of time stamps in 2018-01-03 15:15:04 format. for example:

{'2018-01-03 15:15:04', '2018-01-04 06:32:45', '2018-01-04 23:32:45', '2018-02-23 01:24:32'}

except, I have hundreds of them. Just frequency per hour, month, etc is what I want.

Can anyone point me in the right direction? My two thoughts were this:

  1. Just do the counting and parsing myself and come up with counts per hour and then just throw the data at the chart
  2. Somehow use their built in functionality for time, which I am still a bit unclear about even after reading the docs.

thanks a ton, everyone!

Here's an example of what I would like: Chart example

Also, http://www.chartjs.org/samples/latest/scales/time/financial.html




Aucun commentaire:

Enregistrer un commentaire