1

希望在这里快速提问。我已经概述了一个小文档,它为给定的“defined_range”构建了一个图表。我已将其设置为 10。我还在为“每日”间隔构建图表。由于所有这些以及我使用“this_10_days”作为时间范围这一事实,我应该每天都能看到过去 10 天的数据。

如您所见(jsfiddle.net/L1j08tr7/1/),该对象默认为 12 月 31 日。显然我在这里遗漏了一些东西。解决此问题的任何帮助都将受到极大欢迎,因为我似乎在他们的文档中找不到任何表明此类行为的内容(https://keen.io/docs/data-analysis/timeframe/

另一种方法是将日期传递给每个事件:jsfiddle.net/L1j08tr7/2/

编辑:此处列出的特定日期:sfiddle.net/qarxnxk1/2/

4

2 回答 2

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.

于 2014-09-29T02:19:36.067 回答
1

由于每次生成随机数据时开始日期都相同,因此将在同一天绘制图表。我只是添加了一行来更改每次生成新数据时的开始日期(第 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
            }
        });
    }

我认为这应该给你你正在寻找的东西。这是我的结果:http: //jsfiddle.net/qarxnxk1/

于 2014-09-18T23:19:29.137 回答