remove histrogram, make bar chart wider, eliminate unused css, fix column formatting...
authorScott Baker <smbaker@gmail.com>
Mon, 21 Apr 2014 07:26:00 +0000 (00:26 -0700)
committerScott Baker <smbaker@gmail.com>
Mon, 21 Apr 2014 07:26:00 +0000 (00:26 -0700)
planetstack/core/static/hpc_historical.css
planetstack/hpc_wizard/bigquery_analytics.py
planetstack/hpc_wizard/hpc_wizard.py
planetstack/templates/admin/dashboard/hpc_historical.html

index 412e986..7be52db 100644 (file)
   clear: both;
 }
 
-.col-xs-1,
-.col-sm-1,
-.col-md-1,
-.col-lg-1,
-.col-xs-2,
-.col-sm-2,
-.col-md-2,
-.col-lg-2,
-.col-xs-3,
-.col-sm-3,
-.col-md-3,
-.col-lg-3,
-.col-xs-4,
-.col-sm-4,
-.col-md-4,
-.col-lg-4,
-.col-xs-5,
-.col-sm-5,
-.col-md-5,
-.col-lg-5,
-.col-xs-6,
-.col-sm-6,
-.col-md-6,
-.col-lg-6,
-.col-xs-7,
-.col-sm-7,
-.col-md-7,
-.col-lg-7,
-.col-xs-8,
-.col-sm-8,
-.col-md-8,
-.col-lg-8,
-.col-xs-9,
-.col-sm-9,
-.col-md-9,
-.col-lg-9,
-.col-xs-10,
-.col-sm-10,
-.col-md-10,
-.col-lg-10,
-.col-xs-11,
-.col-sm-11,
-.col-md-11,
-.col-lg-11,
-.col-xs-12,
-.col-sm-12,
-.col-md-12,
-.col-lg-12 {
+.graph_container {
+  width: 800px;
+}
+
+.col-md-halfgraph,
+.col-md-fullgraph {
   position: relative;
   min-height: 1px;
   padding-right: 15px;
   padding-left: 15px;
 }
 
-.col-xs-1,
-.col-xs-2,
-.col-xs-3,
-.col-xs-4,
-.col-xs-5,
-.col-xs-6,
-.col-xs-7,
-.col-xs-8,
-.col-xs-9,
-.col-xs-10,
-.col-xs-11 {
+.col-md-halfgraph,
+.col-md-fullgraph {
   float: left;
 }
-
-.col-xs-12 {
-  width: 100%;
-}
-
-.col-xs-11 {
-  width: 91.66666666666666%;
-}
-
-.col-xs-10 {
-  width: 83.33333333333334%;
-}
-
-.col-xs-9 {
-  width: 75%;
-}
-
-.col-xs-8 {
-  width: 66.66666666666666%;
-}
-
-.col-xs-7 {
-  width: 58.333333333333336%;
-}
-
-.col-xs-6 {
-  width: 50%;
-}
-
-.col-xs-5 {
-  width: 41.66666666666667%;
-}
-
-.col-xs-4 {
-  width: 33.33333333333333%;
-}
-
-.col-xs-3 {
-  width: 25%;
-}
-
-.col-xs-2 {
-  width: 16.666666666666664%;
-}
-
-.col-xs-1 {
-  width: 8.333333333333332%;
-}
-
-.col-xs-pull-12 {
-  right: 100%;
+.col-md-halfgraph {
+  width: 350px;
 }
-
-.col-xs-pull-11 {
-  right: 91.66666666666666%;
-}
-
-.col-xs-pull-10 {
-  right: 83.33333333333334%;
-}
-
-.col-xs-pull-9 {
-  right: 75%;
-}
-
-.col-xs-pull-8 {
-  right: 66.66666666666666%;
-}
-
-.col-xs-pull-7 {
-  right: 58.333333333333336%;
-}
-
-.col-xs-pull-6 {
-  right: 50%;
-}
-
-.col-xs-pull-5 {
-  right: 41.66666666666667%;
-}
-
-.col-xs-pull-4 {
-  right: 33.33333333333333%;
-}
-
-.col-xs-pull-3 {
-  right: 25%;
-}
-
-.col-xs-pull-2 {
-  right: 16.666666666666664%;
-}
-
-.col-xs-pull-1 {
-  right: 8.333333333333332%;
-}
-
-.col-xs-pull-0 {
-  right: 0;
-}
-
-.col-xs-push-12 {
-  left: 100%;
-}
-
-.col-xs-push-11 {
-  left: 91.66666666666666%;
+.col-md-fullgraph {
+  width: 700px;
 }
-
-.col-xs-push-10 {
-  left: 83.33333333333334%;
-}
-
-.col-xs-push-9 {
-  left: 75%;
-}
-
-.col-xs-push-8 {
-  left: 66.66666666666666%;
-}
-
-.col-xs-push-7 {
-  left: 58.333333333333336%;
-}
-
-.col-xs-push-6 {
-  left: 50%;
-}
-
-.col-xs-push-5 {
-  left: 41.66666666666667%;
-}
-
-.col-xs-push-4 {
-  left: 33.33333333333333%;
-}
-
-.col-xs-push-3 {
-  left: 25%;
-}
-
-.col-xs-push-2 {
-  left: 16.666666666666664%;
-}
-
-.col-xs-push-1 {
-  left: 8.333333333333332%;
-}
-
-.col-xs-push-0 {
-  left: 0;
-}
-
-.col-xs-offset-12 {
-  margin-left: 100%;
-}
-
-.col-xs-offset-11 {
-  margin-left: 91.66666666666666%;
-}
-
-.col-xs-offset-10 {
-  margin-left: 83.33333333333334%;
-}
-
-.col-xs-offset-9 {
-  margin-left: 75%;
-}
-
-.col-xs-offset-8 {
-  margin-left: 66.66666666666666%;
-}
-
-.col-xs-offset-7 {
-  margin-left: 58.333333333333336%;
-}
-
-.col-xs-offset-6 {
-  margin-left: 50%;
-}
-
-.col-xs-offset-5 {
-  margin-left: 41.66666666666667%;
-}
-
-.col-xs-offset-4 {
-  margin-left: 33.33333333333333%;
-}
-
-.col-xs-offset-3 {
-  margin-left: 25%;
-}
-
-.col-xs-offset-2 {
-  margin-left: 16.666666666666664%;
-}
-
-.col-xs-offset-1 {
-  margin-left: 8.333333333333332%;
-}
-
-.col-xs-offset-0 {
-  margin-left: 0;
-}
-
-@media (min-width: 768px) {
-  .container {
-    width: 750px;
-  }
-  .col-sm-1,
-  .col-sm-2,
-  .col-sm-3,
-  .col-sm-4,
-  .col-sm-5,
-  .col-sm-6,
-  .col-sm-7,
-  .col-sm-8,
-  .col-sm-9,
-  .col-sm-10,
-  .col-sm-11 {
-    float: left;
-  }
-  .col-sm-12 {
-    width: 100%;
-  }
-  .col-sm-11 {
-    width: 91.66666666666666%;
-  }
-  .col-sm-10 {
-    width: 83.33333333333334%;
-  }
-  .col-sm-9 {
-    width: 75%;
-  }
-  .col-sm-8 {
-    width: 66.66666666666666%;
-  }
-  .col-sm-7 {
-    width: 58.333333333333336%;
-  }
-  .col-sm-6 {
-    width: 50%;
-  }
-  .col-sm-5 {
-    width: 41.66666666666667%;
-  }
-  .col-sm-4 {
-    width: 33.33333333333333%;
-  }
-  .col-sm-3 {
-    width: 25%;
-  }
-  .col-sm-2 {
-    width: 16.666666666666664%;
-  }
-  .col-sm-1 {
-    width: 8.333333333333332%;
-  }
-  .col-sm-pull-12 {
-    right: 100%;
-  }
-  .col-sm-pull-11 {
-    right: 91.66666666666666%;
-  }
-  .col-sm-pull-10 {
-    right: 83.33333333333334%;
-  }
-  .col-sm-pull-9 {
-    right: 75%;
-  }
-  .col-sm-pull-8 {
-    right: 66.66666666666666%;
-  }
-  .col-sm-pull-7 {
-    right: 58.333333333333336%;
-  }
-  .col-sm-pull-6 {
-    right: 50%;
-  }
-  .col-sm-pull-5 {
-    right: 41.66666666666667%;
-  }
-  .col-sm-pull-4 {
-    right: 33.33333333333333%;
-  }
-  .col-sm-pull-3 {
-    right: 25%;
-  }
-  .col-sm-pull-2 {
-    right: 16.666666666666664%;
-  }
-  .col-sm-pull-1 {
-    right: 8.333333333333332%;
-  }
-  .col-sm-pull-0 {
-    right: 0;
-  }
-  .col-sm-push-12 {
-    left: 100%;
-  }
-  .col-sm-push-11 {
-    left: 91.66666666666666%;
-  }
-  .col-sm-push-10 {
-    left: 83.33333333333334%;
-  }
-  .col-sm-push-9 {
-    left: 75%;
-  }
-  .col-sm-push-8 {
-    left: 66.66666666666666%;
-  }
-  .col-sm-push-7 {
-    left: 58.333333333333336%;
-  }
-  .col-sm-push-6 {
-    left: 50%;
-  }
-  .col-sm-push-5 {
-    left: 41.66666666666667%;
-  }
-  .col-sm-push-4 {
-    left: 33.33333333333333%;
-  }
-  .col-sm-push-3 {
-    left: 25%;
-  }
-  .col-sm-push-2 {
-    left: 16.666666666666664%;
-  }
-  .col-sm-push-1 {
-    left: 8.333333333333332%;
-  }
-  .col-sm-push-0 {
-    left: 0;
-  }
-  .col-sm-offset-12 {
-    margin-left: 100%;
-  }
-  .col-sm-offset-11 {
-    margin-left: 91.66666666666666%;
-  }
-  .col-sm-offset-10 {
-    margin-left: 83.33333333333334%;
-  }
-  .col-sm-offset-9 {
-    margin-left: 75%;
-  }
-  .col-sm-offset-8 {
-    margin-left: 66.66666666666666%;
-  }
-  .col-sm-offset-7 {
-    margin-left: 58.333333333333336%;
-  }
-  .col-sm-offset-6 {
-    margin-left: 50%;
-  }
-  .col-sm-offset-5 {
-    margin-left: 41.66666666666667%;
-  }
-  .col-sm-offset-4 {
-    margin-left: 33.33333333333333%;
-  }
-  .col-sm-offset-3 {
-    margin-left: 25%;
-  }
-  .col-sm-offset-2 {
-    margin-left: 16.666666666666664%;
-  }
-  .col-sm-offset-1 {
-    margin-left: 8.333333333333332%;
-  }
-  .col-sm-offset-0 {
-    margin-left: 0;
-  }
-}
-
-@media (min-width: 992px) {
-  .container {
-    width: 970px;
-  }
-  .col-md-1,
-  .col-md-2,
-  .col-md-3,
-  .col-md-4,
-  .col-md-5,
-  .col-md-6,
-  .col-md-7,
-  .col-md-8,
-  .col-md-9,
-  .col-md-10,
-  .col-md-11 {
-    float: left;
-  }
-  .col-md-12 {
-    width: 100%;
-  }
-  .col-md-11 {
-    width: 91.66666666666666%;
-  }
-  .col-md-10 {
-    width: 83.33333333333334%;
-  }
-  .col-md-9 {
-    width: 75%;
-  }
-  .col-md-8 {
-    width: 66.66666666666666%;
-  }
-  .col-md-7 {
-    width: 58.333333333333336%;
-  }
-  .col-md-6 {
-    width: 50%;
-  }
-  .col-md-5 {
-    width: 41.66666666666667%;
-  }
-  .col-md-4 {
-    width: 33.33333333333333%;
-  }
-  .col-md-3 {
-    width: 25%;
-  }
-  .col-md-2 {
-    width: 16.666666666666664%;
-  }
-  .col-md-1 {
-    width: 8.333333333333332%;
-  }
-  .col-md-pull-12 {
-    right: 100%;
-  }
-  .col-md-pull-11 {
-    right: 91.66666666666666%;
-  }
-  .col-md-pull-10 {
-    right: 83.33333333333334%;
-  }
-  .col-md-pull-9 {
-    right: 75%;
-  }
-  .col-md-pull-8 {
-    right: 66.66666666666666%;
-  }
-  .col-md-pull-7 {
-    right: 58.333333333333336%;
-  }
-  .col-md-pull-6 {
-    right: 50%;
-  }
-  .col-md-pull-5 {
-    right: 41.66666666666667%;
-  }
-  .col-md-pull-4 {
-    right: 33.33333333333333%;
-  }
-  .col-md-pull-3 {
-    right: 25%;
-  }
-  .col-md-pull-2 {
-    right: 16.666666666666664%;
-  }
-  .col-md-pull-1 {
-    right: 8.333333333333332%;
-  }
-  .col-md-pull-0 {
-    right: 0;
-  }
-  .col-md-push-12 {
-    left: 100%;
-  }
-  .col-md-push-11 {
-    left: 91.66666666666666%;
-  }
-  .col-md-push-10 {
-    left: 83.33333333333334%;
-  }
-  .col-md-push-9 {
-    left: 75%;
-  }
-  .col-md-push-8 {
-    left: 66.66666666666666%;
-  }
-  .col-md-push-7 {
-    left: 58.333333333333336%;
-  }
-  .col-md-push-6 {
-    left: 50%;
-  }
-  .col-md-push-5 {
-    left: 41.66666666666667%;
-  }
-  .col-md-push-4 {
-    left: 33.33333333333333%;
-  }
-  .col-md-push-3 {
-    left: 25%;
-  }
-  .col-md-push-2 {
-    left: 16.666666666666664%;
-  }
-  .col-md-push-1 {
-    left: 8.333333333333332%;
-  }
-  .col-md-push-0 {
-    left: 0;
-  }
-  .col-md-offset-12 {
-    margin-left: 100%;
-  }
-  .col-md-offset-11 {
-    margin-left: 91.66666666666666%;
-  }
-  .col-md-offset-10 {
-    margin-left: 83.33333333333334%;
-  }
-  .col-md-offset-9 {
-    margin-left: 75%;
-  }
-  .col-md-offset-8 {
-    margin-left: 66.66666666666666%;
-  }
-  .col-md-offset-7 {
-    margin-left: 58.333333333333336%;
-  }
-  .col-md-offset-6 {
-    margin-left: 50%;
-  }
-  .col-md-offset-5 {
-    margin-left: 41.66666666666667%;
-  }
-  .col-md-offset-4 {
-    margin-left: 33.33333333333333%;
-  }
-  .col-md-offset-3 {
-    margin-left: 25%;
-  }
-  .col-md-offset-2 {
-    margin-left: 16.666666666666664%;
-  }
-  .col-md-offset-1 {
-    margin-left: 8.333333333333332%;
-  }
-  .col-md-offset-0 {
-    margin-left: 0;
-  }
-}
-
-@media (min-width: 1200px) {
-  .container {
-    width: 1170px;
-  }
-  .col-lg-1,
-  .col-lg-2,
-  .col-lg-3,
-  .col-lg-4,
-  .col-lg-5,
-  .col-lg-6,
-  .col-lg-7,
-  .col-lg-8,
-  .col-lg-9,
-  .col-lg-10,
-  .col-lg-11 {
-    float: left;
-  }
-  .col-lg-12 {
-    width: 100%;
-  }
-  .col-lg-11 {
-    width: 91.66666666666666%;
-  }
-  .col-lg-10 {
-    width: 83.33333333333334%;
-  }
-  .col-lg-9 {
-    width: 75%;
-  }
-  .col-lg-8 {
-    width: 66.66666666666666%;
-  }
-  .col-lg-7 {
-    width: 58.333333333333336%;
-  }
-  .col-lg-6 {
-    width: 50%;
-  }
-  .col-lg-5 {
-    width: 41.66666666666667%;
-  }
-  .col-lg-4 {
-    width: 33.33333333333333%;
-  }
-  .col-lg-3 {
-    width: 25%;
-  }
-  .col-lg-2 {
-    width: 16.666666666666664%;
-  }
-  .col-lg-1 {
-    width: 8.333333333333332%;
-  }
-  .col-lg-pull-12 {
-    right: 100%;
-  }
-  .col-lg-pull-11 {
-    right: 91.66666666666666%;
-  }
-  .col-lg-pull-10 {
-    right: 83.33333333333334%;
-  }
-  .col-lg-pull-9 {
-    right: 75%;
-  }
-  .col-lg-pull-8 {
-    right: 66.66666666666666%;
-  }
-  .col-lg-pull-7 {
-    right: 58.333333333333336%;
-  }
-  .col-lg-pull-6 {
-    right: 50%;
-  }
-  .col-lg-pull-5 {
-    right: 41.66666666666667%;
-  }
-  .col-lg-pull-4 {
-    right: 33.33333333333333%;
-  }
-  .col-lg-pull-3 {
-    right: 25%;
-  }
-  .col-lg-pull-2 {
-    right: 16.666666666666664%;
-  }
-  .col-lg-pull-1 {
-    right: 8.333333333333332%;
-  }
-  .col-lg-pull-0 {
-    right: 0;
-  }
-  .col-lg-push-12 {
-    left: 100%;
-  }
-  .col-lg-push-11 {
-    left: 91.66666666666666%;
-  }
-  .col-lg-push-10 {
-    left: 83.33333333333334%;
-  }
-  .col-lg-push-9 {
-    left: 75%;
-  }
-  .col-lg-push-8 {
-    left: 66.66666666666666%;
-  }
-  .col-lg-push-7 {
-    left: 58.333333333333336%;
-  }
-  .col-lg-push-6 {
-    left: 50%;
-  }
-  .col-lg-push-5 {
-    left: 41.66666666666667%;
-  }
-  .col-lg-push-4 {
-    left: 33.33333333333333%;
-  }
-  .col-lg-push-3 {
-    left: 25%;
-  }
-  .col-lg-push-2 {
-    left: 16.666666666666664%;
-  }
-  .col-lg-push-1 {
-    left: 8.333333333333332%;
-  }
-  .col-lg-push-0 {
-    left: 0;
-  }
-  .col-lg-offset-12 {
-    margin-left: 100%;
-  }
-  .col-lg-offset-11 {
-    margin-left: 91.66666666666666%;
-  }
-  .col-lg-offset-10 {
-    margin-left: 83.33333333333334%;
-  }
-  .col-lg-offset-9 {
-    margin-left: 75%;
-  }
-  .col-lg-offset-8 {
-    margin-left: 66.66666666666666%;
-  }
-  .col-lg-offset-7 {
-    margin-left: 58.333333333333336%;
-  }
-  .col-lg-offset-6 {
-    margin-left: 50%;
-  }
-  .col-lg-offset-5 {
-    margin-left: 41.66666666666667%;
-  }
-  .col-lg-offset-4 {
-    margin-left: 33.33333333333333%;
-  }
-  .col-lg-offset-3 {
-    margin-left: 25%;
-  }
-  .col-lg-offset-2 {
-    margin-left: 16.666666666666664%;
-  }
-  .col-lg-offset-1 {
-    margin-left: 8.333333333333332%;
-  }
-  .col-lg-offset-0 {
-    margin-left: 0;
-  }
+.col-md-12 {
+  width: 100%;
 }
index 2e65707..994e837 100644 (file)
@@ -91,7 +91,7 @@ class BigQueryAnalytics:
        service = build('bigquery', 'v2', http=http)
 
         body = {"query": query,
-                "timeoutMs": 30000}
+                "timeoutMs": 60000}
         response = service.jobs().query(projectId=PROJECT_NUMBER, body=body).execute()
 
         return response
index bb85847..5c5a3f9 100644 (file)
@@ -316,7 +316,7 @@ def get_hpc_wizard():
 
     if (glo_hpc_wizard is None):
         glo_hpc_wizard = HpcWizard()
-        glo_hpc_wizard.initialize_statistics()
+#        glo_hpc_wizard.initialize_statistics()
 
     return glo_hpc_wizard
 
index 9eb00ba..24d17f2 100644 (file)
 
     <script type="text/javascript" src="//www.google.com/jsapi"></script>
-    <link rel="stylesheet" href="/static/hpc_historical.css">
+       <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
     <script type="text/javascript">
                google.load('visualization', '1', {'packages' : ['controls','table','corechart','geochart']});
     </script>
-
+       
     <script type="text/javascript">
+var queryString = encodeURIComponent("SELECT MINUTE(time) as Time, city, s8 as Node, REGEXP_REPLACE(s8,r'node[0-9]+\.(.*)\.vicci\.org',r'\\1') as Site, AVG(i0) as Cpu, AVG(i1) as Requests FROM [vicci.demoevents] WHERE i0 is not null AND s8 contains 'vicci.org' and not city IN ('princeton','Unknown') and city is not null GROUP BY Time,city,Site,Node ORDER BY Time;");
+                       var serverPart = "http://cloud-scrutiny.appspot.com/command?action=send_query&force=ColumnChart&q="
+                       var dataSourceUrl = serverPart + queryString;
+                       var query;
+
+                       var options = {
+          width: 600,
+          height: 400,
+          showRowNumber: false,
+          pages:true,
+       numRows:9,
+          backgroundColor: "black"
+                       };
+
+google.setOnLoadCallback(function() { sendAndDraw(dataSourceUrl); });
+
+function showNodeAgg(dt) {
+               var tab = new google.visualization.ChartWrapper({
+          'chartType': 'Table',
+          'containerId': 'chart3',
+          'options': {
+            'width': 300,
+            'height': 300,
+            'title': 'Network-wide usage',
+                       'page': 'enable',
+                       'pageSize': 10
+          },
+          'view': {'columns': [0, 1, 2]}
+        });
+
+        tab.setDataTable(dt);
+        tab.draw();
+}
+
+function showSiteTimeAgg(dt) {
+               var lineChart = new google.visualization.ChartWrapper({
+          'chartType': 'LineChart',
+          'containerId': 'chart4',
+          'options': {
+            'width': 300,
+            'height': 300,
+            'title': 'Network-wide usage',
+                       'pages': true,
+                       'numRows': 9
+          },
+          'view': {'columns': [0, 1, 2]}
+        });
+        lineChart.setDataTable(dt);
+        lineChart.draw();
+               /*
+               var scatterChart = new google.visualization.ChartWrapper({
+          'chartType': 'ScatterChart',
+          'containerId': 'chart5',
+          'options': {
+            'width': 300,
+            'height': 300,
+          },
+          // from the 'data' DataTable.
+          'view': {'columns': [1, 2]}
+        });
+               scatterChart.setDataTable(dt);
+               scatterChart.draw();*/
+}
+function showSiteAgg(dt) {
+               var barChart = new google.visualization.ChartWrapper({
+          'chartType': 'ColumnChart',
+          'containerId': 'chart1',
+          'options': {
+            'width': 300,
+            'height': 300,
+            'title': 'Site-wise usage',
+                       'pages': true,
+                       'numRows': 9
+          },
+          // Instruct the piechart to use colums 0 (Name) and 3 (Donuts Eaten)
+          // from the 'data' DataTable.
+          'view': {'columns': [1, 2, 3]}
+        });
+        barChart.setDataTable(dt);
+        barChart.draw();
+               var geoChart = new google.visualization.ChartWrapper({
+          'chartType': 'GeoChart',
+          'containerId': 'chart2',
+          'options': {
+            'width': 300,
+            'height': 300,
+                       'displayMode': 'markers',
+                       'region':'021',
+            'title': 'Usage map',
+               colorAxis: {colors: ['green', 'purple', 'red']}
+          },
+          // Instruct the piechart to use colums 0 (Name) and 3 (Donuts Eaten)
+          // from the 'data' DataTable.
+          'view': {'columns': [0, 2,3]}
+        });
+               geoChart.setDataTable(dt);
+               geoChart.draw();
+       
+               var histogram = new google.visualization.ChartWrapper({
+          'chartType': 'Histogram',
+          'containerId': 'chart6',
+          'options': {
+            'width': 300,
+            'height': 300,
+          },
+                 'title': 'Sites by load',
+          // Instruct the piechart to use colums 0 (Name) and 3 (Donuts Eaten)
+          // from the 'data' DataTable.
+          'view': {'columns': [1, 2]}
+        });
+               histogram.setDataTable(dt);
+               histogram.draw();
+               
+}
+
+function handleResponse(response) {
+var supportedClasses = {
+               'Table':google.visualization.Table,
+               'LineChart':google.visualization.LineChart,
+               'ScatterChart':google.visualization.ScatterChart,
+               'ColumnChart':google.visualization.ColumnChart,
+               'GeoChart':google.visualization.GeoChart,
+               'PieChart':google.visualization.PieChart,
+               'Histogram':google.visualization.Histogram
+       };
+
+       /*var slider2 = new google.visualization.ControlWrapper({
+    'controlType': 'NumberRangeFilter',
+    'containerId': 'control3',
+    'options': {
+      'filterColumnLabel': 'Cpu',
+      minValue: 0,
+      maxValue: 100,
+         ui: { ticks: 10}
+    }
+  });*/
+
+  var timeSlider = new google.visualization.ControlWrapper({
+    'controlType': 'NumberRangeFilter',
+    'containerId': 'control1',
+    'options': {
+      'filterColumnLabel': 'Time',
+         ui: { ticks: 10}
+    }
+  });
+
+  // Define a bar chart
+  var barChart = new google.visualization.ChartWrapper({
+    'chartType': 'BarChart',
+    'containerId': 'chart1',
+    'options': {
+      'width': 400,
+      'height': 300,
+      'hAxis': {'minValue': 0, 'maxValue': 60},
+      'chartArea': {top: 0, right: 0, bottom: 0}
+    }
+  });
+
+       var categoryPicker = new google.visualization.ControlWrapper({
+          'controlType': 'CategoryFilter',
+          'allowMultiple': true,
+          'containerId': 'control2',
+          'options': {
+            'filterColumnLabel': 'Site',
+            'ui': {
+            'labelStacking': 'vertical',
+              'allowTyping': false
+            }
+          }
+        });
+       //var container = document.getElementById('datatable');
+       //var table = new google.visualization.LineChart(container);
+       //var table = new google.visualization.ColumnChart(container);
+
+       var proxy = new google.visualization.ChartWrapper({
+          'chartType': 'Table',
+          'containerId': 'chart7',
+          'options': {
+            'width': 800,
+            'height': 300,
+                       pageSize:5,
+                       page:'enable',
+            'legend': 'none',
+            'title': 'Nodes'
+          },
+          // Instruct the piechart to use colums 0 (Name) and 3 (Donuts Eaten)
+          // from the 'data' DataTable.
+          'view': {'columns': [0,1,2,3,4,5]}
+        });
+
+       function core_sum(arr) {
+               var ret = 0;
+               for (var i = 0; i < arr.length; i++) {
+                       ret+=arr[i]/1000;
+               }
+               return ret;
+       }
+
+       function scaled_sum(arr) {
+               var ret = 0;
+               for (var i = 0; i < arr.length; i++) {
+                       ret+=arr[i]/1000;
+               }
+               return ret;
+       }
+
+       function count_uniq(arr) {
+               var counts = {};
+               var ret = 0;
+               console.log('Starting ret '+ret);
+               for (var i = 0; i < arr.length; i++) {
+                               if (!counts[arr[i]]) ret+=1;
+                           counts[arr[i]] = 1;
+               }
+               return ret;
+       }       
+       google.visualization.events.addListener(proxy, 'ready', function () {
+        // 0 - time 1 - city 2 - node 3 - site 4 - cpu 5 - bytes
+        var dt = proxy.getDataTable();
+               var groupedData1 = google.visualization.data.group(dt, [0], [{
+            column: 4,
+            type: 'number',
+            label: dt.getColumnLabel(4),
+            aggregation: google.visualization.data.sum
+        },{
+                       column: 5,
+            type: 'number',
+            label: dt.getColumnLabel(5),
+            aggregation: google.visualization.data.sum
+               }]);
+
+        showSiteTimeAgg(groupedData1);
+    });
+
+       /*google.visualization.events.addListener(proxy, 'ready', function () {
+        // 0 - time 1 - city 2 - node 3 - site 4 - cpu 5 - bytes
+        var dt = proxy.getDataTable();
+        var groupedData0 = google.visualization.data.group(dt, [2], [{
+            column: 4,
+            type: 'number',
+            label: dt.getColumnLabel(4),
+            aggregation: google.visualization.data.sum
+        },{
+                       column: 5,
+            type: 'number',
+            label: dt.getColumnLabel(5),
+            aggregation: google.visualization.data.sum
+               }]);
+        // after grouping, the data will be sorted by column 0, then 1, then 2
+        // if you want a different order, you have to re-sort
+               showNodeAgg(groupedData0);
+               });*/
+
+       google.visualization.events.addListener(proxy, 'ready', function () {
+        // 0 - time 1 - city 2 - node 3 - site 4 - cpu 5 - bytes
+        var dt = proxy.getDataTable();
+        var groupedData0 = google.visualization.data.group(dt, [1,3], [{
+            column: 4,
+            type: 'number',
+            label: 'Cores',
+            aggregation: core_sum
+        },{
+                       column: 5,
+            type: 'number',
+            label: dt.getColumnLabel(5),
+            aggregation: scaled_sum
+               }]);
+        // after grouping, the data will be sorted by column 0, then 1, then 2
+        // if you want a different order, you have to re-sort
+               showSiteAgg(groupedData0);
+            });
+
+       data = response.getDataTable();
+       new google.visualization.Dashboard(document.getElementById('dashboard')).
+            // Establish bindings, declaring the both the slider and the category
+            // picker will drive both charts.
+            bind([categoryPicker,timeSlider], [proxy]).
+            // Draw the entire dashboard.
+            draw(data);
 
-     var options = {
-\r         width: 600,\r
-         height: 400,\r
-         showRowNumber: false,\r
-         pages: true,\r
-         numRows: 9,\r
-         backgroundColor: "black"\r
-     };\r
-\r
-     // ask django for a data source URL to use for the graphs\r
-\r
-     function updateDataSourceUrl() {\r
-         var sliceName = $("#historical_slicename :selected").text();\r
-         var queryString = "/analytics/bigquery/?sum=@bytes_sent&avg=@cpu&groupBy=Time,city,@hostname,@site&slice=" + sliceName;\r
-\r
-         $.ajax({\r
-             url: queryString,\r
-             dataType: 'json',\r
-             type: 'GET',\r
-             success: function (newData) {\r
-                 sendAndDraw(newData["dataSourceUrl"])\r
-             }\r
-         });\r
-     }\r
-\r
-     TIME_COL = 0;\r
-     BANDWIDTH_COL = 2;\r
-     CPU_COL = 1;\r
-     CITY_COL = 3;\r
-     NODE_COL = 4;\r
-     SITE_COL = 5;\r
-\r
-     google.setOnLoadCallback(function () {\r
-         $('#historical_slicename').change(function()\r
-         {\r
-             updateDataSourceUrl();\r
-         });\r
-\r
-         updateDataSourceUrl();\r
-     });\r
-\r
-     function showSiteTimeAgg(dt) {\r
-         var lineChart = new google.visualization.ChartWrapper({\r
-             'chartType': 'LineChart',\r
-             'containerId': 'chart4',\r
-             'options': {\r
-                 'width': 300,\r
-                 'height': 300,\r
-                 'title': 'Network-wide usage',\r
-                 'pages': true,\r
-                 'numRows': 9\r
-             },\r
-             'view': {\r
-                 'columns': [0, 1, 2]\r
-             }\r
-         });\r
-         lineChart.setDataTable(dt);\r
-         lineChart.draw();\r
-     }\r
-\r
-     function showSiteAgg(dt) {\r
-         var barChart = new google.visualization.ChartWrapper({\r
-             'chartType': 'ColumnChart',\r
-             'containerId': 'chart1',\r
-             'options': {\r
-                 'width': 300,\r
-                 'height': 300,\r
-                 'title': 'Site-wise usage',\r
-                 'pages': true,\r
-                 'numRows': 9\r
-             },\r
-             'view': {\r
-                 'columns': [1, 2, 3]\r
-             }\r
-         });\r
-         barChart.setDataTable(dt);\r
-         barChart.draw();\r
-         var geoChart = new google.visualization.ChartWrapper({\r
-             'chartType': 'GeoChart',\r
-             'containerId': 'chart2',\r
-             'options': {\r
-                 'width': 300,\r
-                 'height': 300,\r
-                 'displayMode': 'markers',\r
-                 'region': '021',\r
-                 'title': 'Usage map',\r
-                 colorAxis: {\r
-                     colors: ['green', 'purple', 'red']\r
-                 }\r
-             },\r
-             'view': {\r
-                 'columns': [0, 2, 3]\r
-             }\r
-         });\r
-         geoChart.setDataTable(dt);\r
-         geoChart.draw();\r
-\r
-         var histogram = new google.visualization.ChartWrapper({\r
-             'chartType': 'Histogram',\r
-             'containerId': 'chart6',\r
-             'options': {\r
-                 'width': 300,\r
-                 'height': 300,\r
-             },\r
-             'title': 'Sites by load',\r
-             'view': {\r
-                 'columns': [1, 2]\r
-             }\r
-         });\r
-         histogram.setDataTable(dt);\r
-         histogram.draw();\r
-\r
-     }\r
-\r
-     function handleResponse(response) {\r
-         var timeSlider = new google.visualization.ControlWrapper({\r
-             'controlType': 'DateRangeFilter',\r
-             'containerId': 'control1',\r
-             'options': {\r
-                 'filterColumnLabel': 'Time',\r
-                 ui: {\r
-                     ticks: 10,\r
-                     step: "minute"\r
-                 }\r
-             }\r
-         });\r
-\r
-         // Define a bar chart\r
-         var barChart = new google.visualization.ChartWrapper({\r
-             'chartType': 'BarChart',\r
-             'containerId': 'chart1',\r
-             'options': {\r
-                 'width': 400,\r
-                 'height': 300,\r
-                 'hAxis': {\r
-                     'minValue': 0,\r
-                     'maxValue': 60\r
-                 },\r
-                 'chartArea': {\r
-                     top: 0,\r
-                     right: 0,\r
-                     bottom: 0\r
-                 }\r
-             }\r
-         });\r
-\r
-         var categoryPicker = new google.visualization.ControlWrapper({\r
-             'controlType': 'CategoryFilter',\r
-             'allowMultiple': true,\r
-             'containerId': 'control2',\r
-             'options': {\r
-                 'filterColumnLabel': 'site',\r
-                 'ui': {\r
-                     'labelStacking': 'vertical',\r
-                     'allowTyping': false\r
-                 }\r
-             }\r
-         });\r
-\r
-         var proxy = new google.visualization.ChartWrapper({\r
-             'chartType': 'Table',\r
-             'containerId': 'chart7',\r
-             'options': {\r
-                 'width': 800,\r
-                 'height': 300,\r
-                 pageSize: 5,\r
-                 page: 'enable',\r
-                 'legend': 'none',\r
-                 'title': 'Nodes'\r
-             },\r
-             'view': {\r
-                 'columns': [0, 1, 2, 3, 4, 5]\r
-             }\r
-         });\r
-\r
-         function avg_bandwidth(arr) {\r
-                var ret = 0;
-                for (var i = 0; i < arr.length; i++) {
-                        ret+=arr[i]*8.0/1024.0/1024.0/1024.0;
-                }
-                if (arr.length==0) {
-                    return 0;
-                }
-                return ret/arr.length;
-         }\r
-\r
-         function sum_bytes_sent_as_bw(arr) {\r
-                var ret = 0;
-                for (var i = 0; i < arr.length; i++) {
-                        ret+=arr[i]*8.0/1024.0/1024.0/1024.0;
-                }
-                return ret/60.0;
-         }\r
-\r
-         function sum_bytes_sent_as_GB(arr) {\r
-                var ret = 0;
-                for (var i = 0; i < arr.length; i++) {
-                        ret+=arr[i]/1024.0/1024.0/1024.0;
-                }
-                return ret;
-         }\r
-\r
-         function fixDate2(unixDate) {\r
-             // not completely sure why we have to do this, as the data was in\r
-             // javascript Date() objects to start with. If we don't do it,\r
-             // then the horizontal axis will be blank.\r
-             return new Date(unixDate);
-         }\r
-\r
-         var format0dp = new google.visualization.NumberFormat({fractionDigits:0});\r
-         var format2dp = new google.visualization.NumberFormat({fractionDigits:2});\r
-\r
-         // Create a group for charts that will have a horizontal axis that is\r
-         // time.\r
-\r
-         google.visualization.events.addListener(proxy, 'ready', function () {\r
-             var dt = proxy.getDataTable();\r
-             var groupedData1 = google.visualization.data.group(dt, [{\r
-                 column: TIME_COL,
-                 type: 'datetime',
-                 modifier: fixDate2,
-             }], [{\r
-                 column: CPU_COL,\r
-                 type: 'number',\r
-                 label: "avg cpu",\r
-                 aggregation: google.visualization.data.avg\r
-             }, {\r
-                 column: BANDWIDTH_COL,\r
-                 type: 'number',\r
-                 label: "Gbps",\r
-                 aggregation: sum_bytes_sent_as_bw\r
-             }]);\r
-\r
-             format0dp.format(groupedData1,1);\r
-             format2dp.format(groupedData1,2);\r
-\r
-             showSiteTimeAgg(groupedData1);\r
-         });\r
-\r
-         // Create a group for charts that will have a horizontal axis that is\r
-         // city or site.\r
-\r
-         google.visualization.events.addListener(proxy, 'ready', function () {\r
-             var dt = proxy.getDataTable();\r
-             var groupedData0 = google.visualization.data.group(dt, [CITY_COL, SITE_COL], [{\r
-                 column: CPU_COL,\r
-                 type: 'number',\r
-                 label: 'avg cpu',\r
-                 aggregation: google.visualization.data.avg\r
-             }, {\r
-                 column: BANDWIDTH_COL,\r
-                 type: 'number',\r
-                 label: "GB sent",\r
-                 aggregation: sum_bytes_sent_as_GB\r
-             }]);\r
-\r
-             format0dp.format(groupedData0,2);\r
-             format2dp.format(groupedData0,3);\r
-\r
-             showSiteAgg(groupedData0);\r
-         });\r
-\r
-         data = response.getDataTable();\r
-         new google.visualization.Dashboard(document.getElementById('dashboard')).\r
-         // Establish bindings, declaring the both the slider and the category\r
-         // picker will drive both charts.\r
-         bind([categoryPicker, timeSlider], [proxy]).\r
-         // Draw the entire dashboard.\r
-         draw(data);\r
-\r
-     }\r
-\r
-     function sendAndDraw(queryString) {\r
-         query = new google.visualization.Query(queryString)\r
-         query && query.abort();\r
-         query.send(function (response) {\r
-             handleResponse(response);\r
-         });\r
-     }
+}
+function sendAndDraw(queryString) {
+       query = new google.visualization.Query(queryString)
+       query && query.abort();
+       query.send(function(response) {handleResponse(response);});
+}
+      
 
     </script>
     <div id="dashboard" class="container">
-                <div class="row">
-                        <span><b>Slice Name:</b></span>
-                        <span><select id="historical_slicename">
-                        {% for slice in userSliceInfo %}
-                           <option value="{{ slice.slicename }}">{{ slice.slicename }}</option>
-                        {% endfor %}
-                        </select></span>
-                </div>
                <div class="row">
                        <div class="col-md-8">
                                <div class="col-md-4" id="control2"></div>