Charlie Clark avatar Charlie Clark committed 675dd18

Added HTML trends
Cleaned up incorrect names in JS

Comments (0)

Files changed (2)

httparchive/httparchive/views/site_gviz.py

         return encoder.encode(table)
 
     @property
+    def trends_html(self):
+        table = Table()
+        table.add_column("Date", datetime.date)
+        table.add_column("HTML Transfer Size", int)
+        table.add_column("HTML Requests", int)
+        for r in self.trends:
+            table.append([r.labelDate, int(r.reqHTML), int(r.bytesHTML)])
+        return encoder.encode(table)
+
+    @property
     def trends(self):
         """
         Matches dbapi.getTrendsDataForURL except site.id is a key.

httparchive/httparchive/views/templates/site_gviz.pt

       }
 
 		google.setOnLoadCallback(protocols);
-    	function cache_control() {
+    	function protocols() {
         var data = new google.visualization.DataTable(${view.protocols});
 
         var options = {
       }
 
 		google.setOnLoadCallback(trend_requests);
-    	function cache_control() {
+    	function trend_requests() {
         var data = new google.visualization.DataTable(${view.trends_requests});
 
         var options = {
           title : "Total Transfer Size & Total Requests",
 		  series: [
-		  {targetAxisIndex: 0, visibleInLegend:false, color:'#15A50E'},
-		  {targetAxisIndex: 1, visibleInLegend:false, color:'#006600'},
+		  {targetAxisIndex: 0, color:'#15A50E'},
+		  {targetAxisIndex: 1, color:'#006600'},
 				   ],
 		  vAxes:[
-				{title:'Total Requests', color:'#15A50E'},
-				{title:'Total Transfer Size', color:'#006600'}
+				{color:'#15A50E'},
+				{color:'#006600'}
 				]
         };
 
         chart.draw(data, options);
       }
 
+
+		google.setOnLoadCallback(trends_html);
+    	function trends_html() {
+        var data = new google.visualization.DataTable(${view.trends_html});
+
+        var options = {
+          title : "HTML Transfer Size & HTML Requests",
+		  series: [
+		  {targetAxisIndex: 0, color:'#014F78'},
+		  {targetAxisIndex: 1, color:'#3399CC'},
+				   ],
+		  vAxes:[
+				{color:'#014F78'},
+				{color:'#3399CC'}
+				]
+        };
+
+        var chart = new google.visualization.LineChart(document.getElementById('trends_html'));
+        chart.draw(data, options);
+      }
+
 	</script>
 
 <a href="#bytesperpage">
     <div id="trends_requests"></div>
 </a>
 
+<a href="#total_html">
+    <div id="trends_html"></div>
+</a>
+
 </section>
 
 </metal:slot>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.