Skip to content

Instantly share code, notes, and snippets.

@wetzler
Created January 31, 2014 18:46
Show Gist options
  • Save wetzler/8739951 to your computer and use it in GitHub Desktop.
Save wetzler/8739951 to your computer and use it in GitHub Desktop.
workaround for saved queries drawing weirdness
var query = new Keen.SavedQuery("activity_09_2013");
query.getResponse(function(response){
console.log(response.result);
// Call Michelle's gross function
drawMyLineChart(response, "daily", div , title)
});
function drawMyLineChart(response, interval, div, title) {
// Create a Series object so that it can be referenced by the draw method.
// This is kind of a hack since we are passing in our own result object and not really querying the collection specified here.
// The "placeholder" is used instead of a collection name, since this is not used.
var placeholderSeries = new Keen.Series("placeholder", {
interval: interval
})
var lineChart = new Keen.LineChart(placeholderSeries, {
height: 400,
width: 600,
lineWidth: 3,
chartAreaWidth: "60%",
chartAreaLeft: "10%",
title: title,
showLegend: false,
xAxisLabelAngle: xAxisLabelAngle
});
lineChart.draw(document.getElementById(div), formattedResult);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment