From c540c3f1b810c44ea9c56c517dd2865fd1f4d8d3 Mon Sep 17 00:00:00 2001
From: Schankula Christopher <schankuc@mcmaster.ca>
Date: Mon, 2 Apr 2018 18:05:28 -0400
Subject: [PATCH] merge

---
 tomcat/webapps/Trawl/histogram.js  |  1 +
 tomcat/webapps/Trawl/histogram.jsp | 11 ++++++++---
 tomcat/webapps/Trawl/script.js     |  2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tomcat/webapps/Trawl/histogram.js b/tomcat/webapps/Trawl/histogram.js
index e30cc6d..ba39517 100644
--- a/tomcat/webapps/Trawl/histogram.js
+++ b/tomcat/webapps/Trawl/histogram.js
@@ -19,6 +19,7 @@ function histogram(x,y){
 	      			size: 18,
 	      			color: '#7f7f7f'
 	    			}
+		, autosize: true
 	    	},
 	    	yaxis:{title: 'Individual count',
 	    		titlefont: {
diff --git a/tomcat/webapps/Trawl/histogram.jsp b/tomcat/webapps/Trawl/histogram.jsp
index 17cb163..ef34b15 100644
--- a/tomcat/webapps/Trawl/histogram.jsp
+++ b/tomcat/webapps/Trawl/histogram.jsp
@@ -5,13 +5,18 @@
 
 <%
 		TrawlExpert te = (TrawlExpert)request.getServletContext().getAttribute("trawl");
-		BasicSearchResult result = te.rangeSearch(2, 1960, 2016);
+		JSONParser parser = new JSONParser();
+		JSONObject req = (JSONObject) parser.parse(request.getReader().readLine());
+
+		Integer taxonId = (int) (long) req.get("taxId");
+		Integer yearLo = (int) (long) req.get("yearF");
+		Integer yearHi = (int) (long) req.get("yearT");
+
+		BasicSearchResult result = te.rangeSearch(taxonId, yearLo, yearHi);
 
 		BST<Integer, Integer> histogram = result.histogram();
 		Iterable<Integer> results = histogram.keys();
 		
-		JSONParser parser = new JSONParser();
-		
 		
 		JSONObject js = new JSONObject();
 		JSONArray x = new JSONArray();
diff --git a/tomcat/webapps/Trawl/script.js b/tomcat/webapps/Trawl/script.js
index 7c70b5f..85f8f3d 100644
--- a/tomcat/webapps/Trawl/script.js
+++ b/tomcat/webapps/Trawl/script.js
@@ -199,7 +199,7 @@ function callOutput(){
     var params= JSON.stringify({taxId: Number(taxGroup), yearF: Number(yearFrom), yearT: Number(yearTo)});
 
     //Switch Output Display
-    if(outType === "Histogram"){
+    if(outType === "histogram"){
         reqHistogram(params);
     }
     else{
-- 
GitLab