Jake232
Jake232

Reputation: 227

Refreshing a Keen.io graph / query

The following docs make it seem like my code should work, however I'm getting an undefined error, I'm sure it's something simple but I can't quite get my head around it.

https://github.com/keen/keen-js/blob/master/docs/visualization.md#automatic-updates

var clicks_keen = new Keen.Query("count", {
eventCollection: "clicks",
groupBy: "campaign.id",
interval: window.interval,
timeframe: window.timeframe
});

clicks_keen.refresh();

Upvotes: 3

Views: 393

Answers (1)

Jake232
Jake232

Reputation: 227

It turns out that bebraw was correct. You need to store the result of client.run() in a variable, and call refresh on that object.

You also need to keep the original Query in a variable though as to update any actual data for the query (change the timeframe etc) you need that object.

Upvotes: 4

Related Questions