Permalink
Browse files

correctly retrieves data, but SO's if getting more than 1000 records.…

… Caused by recursive function in record-retriever/get-helper
  • Loading branch information...
1 parent a615774 commit 33df905b27e687103ec0386796758911ab750b4f @marshallbrekka committed Jun 13, 2012
Showing 773 changed files with 24,923 additions and 47 deletions.
View
@@ -3,4 +3,8 @@ pom.xml
/lib/
/classes/
.lein-deps-sum
-.cake
+.cake
+target
+*.swp
+.DS_Store
+.class
View
Binary file not shown.
View
@@ -1,6 +1,35 @@
(defproject analytics-clj "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
- :dependencies [[congomongo "0.1.9"][org.clojure/clojure "1.4.0"]
- [noir "1.3.0-beta3"][com.novemberain/monger "1.0.0-rc1"]]
+ :dependencies [
+ [congomongo "0.1.9"]
+ [org.clojure/clojure "1.4.0"]
+ [com.novemberain/monger "1.0.0-rc1"]
+ [noir "1.3.0-beta7"]
+ [org.clojure/tools.logging "0.2.3"]
+ [clj-ical "1.1"]
+ [cheshire "4.0.0"]
+ [stencil "0.2.0"]
+ [congomongo "0.1.9"]
+ [korma "0.3.0-beta10"]
+ [clj-time "0.4.2"]
+ [clj-http "0.4.1"]
+ [postgresql "9.1-901-1.jdbc4"]
+ [ibdknox/clj-record "1.0.4"]
+ [incanter/incanter-core "1.3.0"]
+ [incanter/incanter-charts "1.3.0"]
+ [twitter-api "0.6.10"]
+ [trammel "0.8.0-SNAPSHOT"]
+ [expectations "1.4.3"]
+ [org.clojure/data.json "0.1.3"]
+ [com.notnoop.apns/apns "0.1.6"]
+ [org.jsoup/jsoup "1.6.2"]
+ [org.clojure/data.zip "0.1.1"]
+ [org.slf4j/slf4j-log4j12 "1.6.4"]
+ [org.clojure/data.csv "0.1.2"]
+ [log4j/apache-log4j-extras "1.1"]
+
+
+
+ ]
:main analytics-clj.server)
@@ -0,0 +1,9 @@
+body {
+ text-align :center;
+ }
+ #container {
+ text-align:left;
+ }
+#container {
+ height: 500px; min-width: 500px";
+ }
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,74 @@
+
+
+
+function getData() {
+ var data = new api({
+ url:'http://' + location.hostname + ':' + location.port + '/api'
+ });
+ data.get({}, function(data){
+
+ console.log(data.length);
+ console.log(data);
+ /*data = data.sort(function(a,b){
+ if(a[0] < b[0])
+ return -1;
+ if(a[0] > b[0])
+ return 1;
+ return 0
+ });*/
+ //console.log(data.splice(0,100));
+ //data = processData(data);
+ $('#loader').hide();
+ createGraph('container', data);
+
+ });
+}
+
+
+
+function createGraph(container, data) {
+ window.chart = new Highcharts.StockChart({
+ chart : {
+ renderTo : container
+ },
+
+ rangeSelector : {
+ selected : 1
+ },
+
+ title : {
+ text : 'Total User Balance'
+ },
+
+ series : [{
+
+ data : data,
+ pointStart: new Date(data[0][0]),
+ pointInterval: 24 * 3600,
+ tooltip: {
+ valueDecimals: 2
+ }
+ }]
+ });
+
+
+}
+
+
+function processData(data) {
+ var newData = [];
+ var temp;
+ for(var i = 0; i < data.length;) {
+ var sameKeys = [i];
+ var key = data[i][1];
+ while(++i < data.length && data[i][1] == key) {
+ sameKeys.push(i);
+ }
+ temp = 0;
+ for(var k = 0; k < sameKeys.length; k++) {
+ temp += data[sameKeys[k]][2];
+ }
+ newData.push([key, temp / sameKeys.length]);
+ }
+ return newData;
+}
View
@@ -0,0 +1,27 @@
+
+/**
+ * creates the api object to retrieve data
+ * @param {string} config.url location of the database
+ *
+ */
+var api = function(config) {
+ this.config = config;
+}
+
+api.prototype.get = function(filters, cb) {
+ this._request(filters, cb);
+}
+
+api.prototype._request = function(data, cb) {
+ $.ajax({
+ url : this.config.url,
+ data : data,
+ dataType : 'json',
+ success : function(data) {
+ cb(data);
+ },
+ error : function(d, t) {
+ console.log("there was an error \n" + t);
+ }
+ });
+}
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Highstock Example</title>
+
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script type="text/javascript">
+$(function() {
+ $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
+
+ // Create the chart
+ window.chart = new Highcharts.StockChart({
+ chart : {
+ renderTo : 'container'
+ },
+
+ rangeSelector : {
+ selected : 1
+ },
+
+ title : {
+ text : 'AAPL Stock Price'
+ },
+
+ series : [{
+ name : 'AAPL Stock Price',
+ data : data,
+ type : 'area',
+ threshold : null,
+ tooltip : {
+ valueDecimals : 2
+ },
+ fillColor : {
+ linearGradient : {
+ x1: 0,
+ y1: 0,
+ x2: 0,
+ y2: 1
+ },
+ stops : [[0, Highcharts.getOptions().colors[0]], [1, 'rgba(0,0,0,0)']]
+ }
+ }]
+ });
+ });
+});
+
+ </script>
+ </head>
+ <body>
+<script src="http://code.highcharts.com/stock/highstock.js"></script>
+<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
+
+<div id="container" style="height: 500px; min-width: 500px"></div>
+ </body>
+</html>
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Highstock Example</title>
+
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script type="text/javascript">
+$(function() {
+ $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
+
+ // Create the chart
+ window.chart = new Highcharts.StockChart({
+ chart : {
+ renderTo : 'container'
+ },
+
+ rangeSelector : {
+ selected : 1
+ },
+
+ title : {
+ text : 'AAPL Stock Price'
+ },
+
+ series : [{
+ name : 'AAPL Stock Price',
+ data : data,
+ type : 'areaspline',
+ threshold : null,
+ tooltip : {
+ valueDecimals : 2
+ },
+ fillColor : {
+ linearGradient : {
+ x1: 0,
+ y1: 0,
+ x2: 0,
+ y2: 1
+ },
+ stops : [[0, Highcharts.getOptions().colors[0]], [1, 'rgba(0,0,0,0)']]
+ }
+ }]
+ });
+ });
+});
+
+ </script>
+ </head>
+ <body>
+<script src="http://code.highcharts.com/stock/highstock.js"></script>
+<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
+
+<div id="container" style="height: 500px; min-width: 500px"></div>
+ </body>
+</html>
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Highstock Example</title>
+
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script type="text/javascript">
+$(function() {
+
+ $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
+ // Create the chart
+ window.chart = new Highcharts.StockChart({
+ chart : {
+ renderTo : 'container'
+ },
+
+ rangeSelector : {
+ selected : 1
+ },
+
+ title : {
+ text : 'AAPL Stock Price'
+ },
+
+ series : [{
+ name : 'AAPL',
+ data : data,
+ tooltip: {
+ valueDecimals: 2
+ }
+ }]
+ });
+ });
+
+});
+
+ </script>
+ </head>
+ <body>
+<script src="http://code.highcharts.com/stock/highstock.js"></script>
+<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
+
+<div id="container" style="height: 500px; min-width: 500px"></div>
+ </body>
+</html>
Oops, something went wrong.

0 comments on commit 33df905

Please sign in to comment.