Created
January 14, 2014 03:34
-
-
Save shaohua/8412587 to your computer and use it in GitHub Desktop.
keen showLineChart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| showLineChart: function(){ | |
| Keen.onChartsReady(function(){ | |
| //Find the amount of money made from purchases each day for the last 7 days | |
| //only count the users that that are over 21 years old. | |
| var mySeries = new Keen.Series("purchases", { | |
| analysisType: "sum", | |
| targetProperty: "total_price", | |
| timeframe: "previous_7_days", | |
| interval: "daily" | |
| }); | |
| mySeries.addFilter("user.age", "gt", 21); | |
| //Draw a line chart in a <div/> with an ID of "purchases" | |
| var myLineChart = new Keen.LineChart(mySeries, { | |
| height: 500, | |
| width: 200, | |
| lineWidth: 5, | |
| color: "red", | |
| backgroundColor: "transparent", | |
| title: "Purchases over Previous 7 Days", | |
| showLegend: false | |
| }); | |
| myLineChart.draw(document.getElementById("purchases")); | |
| }); | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment