Reputation:
I downloaded a sample which users Keen.js to pull data for a pie chart.
I just need to hardcode some data into the chart,
For example 50% pass, 50% fail.
var pageviews_static = new Keen.Query("count", {
eventCollection: "pageviews",
groupBy: "user.device_info.browser.family",
timeframe: {
start: "2014-05-01T00:00:00.000Z",
end: "2014-05-05T00:00:00.000Z"
}
});
client.draw(pageviews_static, document.getElementById("chart-02"), {
chartType: "piechart",
title: false,
height: 250,
width: "auto",
chartOptions: {
chartArea: {
height: "85%",
left: "5%",
top: "5%",
width: "100%"
},
pieHole: .4
}
});
How can I hardcode pageview_static to 50% pass, 50% fail
Upvotes: 3
Views: 96
Reputation: 487
You can customize the google charts options that are exposed by keen.js.
Customized labels for the data: https://github.com/keen/keen-js/blob/master/docs/visualization.md#customized-labels
and Custom data objects "Keen.Dataset: https://github.com/keen/keen-js/tree/master/docs/dataset#keendataset
var chart = new Keen.Dataviz()
.el(document.getElementById("chart"))
.chartType('piechart')
.parseRawData({ result: [
{ label: 'Pass', value: 50 },
{ label: 'Fail', value: 50 }
] })
.title('Pass/Fail Rate')
.height(240)
.render();
Upvotes: 4