1

Quick question here hopefully. I have outlined a small document which builds a chart for a given "defined_range". I have set this to 10. I am also building the chart for "daily" intervals. Because of all this and the fact that I am using the "this_10_days" as the timeframe, I should be seeing data across the last 10 days, for each day.

As you can see (jsfiddle.net/L1j08tr7/1/), the object is defaulting to December 31. Clearly I am missing something here. Any help at approaching this issue would be greatly welcomed as I cannot seem to find anything indicating this type of behavior within their documentation (https://keen.io/docs/data-analysis/timeframe/)

Another approach would be to pass dates to each event: jsfiddle.net/L1j08tr7/2/

Edit: Specific days charted here: sfiddle.net/qarxnxk1/2/

Jadissa
  • 25
  • 1
  • 5

2 Answers2

2

Keen IO offers users the ability to create queries and interesting visualization based off of those.

Check this out: http://jsfiddle.net/qarxnxk1/3/

var query = new Keen.Query("count", {
    eventCollection: "new_high_score2",
    groupBy: "best_score"
  });
client.draw(query, document.getElementById("chart"), {
    // Custom configuration here
});

You don't have to create the timeframe yourself. Keen takes care of that for you. This is just a simplified version of what you are looking for but you can also do something along the lines of:

var series = new Keen.Query("count", {
  eventCollection: "page views",
  timeframe: {
    start: "2014-05-04T00:00:00.000Z",
    end: "2014-05-05T00:00:00.000Z"
  },
  interval: "daily"
});

If you would like more samples of queries check out this repo: https://github.com/keenlabs/dashboards

Hope this helps.

Sean
  • 779
  • 6
  • 18
1

Since the start date is the same every time you generate your random data, it will be graphed on the same day. I just added one line to change the start date each time you generate new data (line 26): date_begin.setDate(i),

for (i = 0; i < days; i++)
    {  
        date_begin.setDate(i);
        chart_data.push({
            "value": genValue(),
            "interval":interval,
            "timeframe":
            {
                "start":date_begin.toISOString().replace('Z','') + timezone_offset,
                "end":date_end.toISOString().replace('Z','') + timezone_offset
            }
        });
    }

and I think that should give you what you are looking for. Here is my result: http://jsfiddle.net/qarxnxk1/

  • Thank you! I was able to take that bit of info and chart out specific days. I'm updating my original post – Jadissa Sep 19 '14 at 16:27