diff --git a/portfolio/src/main/java/com/google/sps/servlets/CoronavirusDataServlet.java b/portfolio/src/main/java/com/google/sps/servlets/CoronavirusDataServlet.java index 703d51b..725dfde 100644 --- a/portfolio/src/main/java/com/google/sps/servlets/CoronavirusDataServlet.java +++ b/portfolio/src/main/java/com/google/sps/servlets/CoronavirusDataServlet.java @@ -16,7 +16,8 @@ import com.google.gson.Gson; import java.io.IOException; -import java.util.LinkedHashMap; +import java.util.HashMap; +import java.util.Map; import java.util.Scanner; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; @@ -27,7 +28,7 @@ @WebServlet("/coronavirus-data") public class CoronavirusDataServlet extends HttpServlet { - private final LinkedHashMap coronavirusCases = new LinkedHashMap<>(); + private final Map coronavirusCases = new HashMap<>(); @Override public void init() { diff --git a/portfolio/src/main/java/com/google/sps/servlets/DeleteCommentServlet.java b/portfolio/src/main/java/com/google/sps/servlets/DeleteCommentServlet.java index b678c3a..5317df2 100644 --- a/portfolio/src/main/java/com/google/sps/servlets/DeleteCommentServlet.java +++ b/portfolio/src/main/java/com/google/sps/servlets/DeleteCommentServlet.java @@ -50,5 +50,5 @@ private void deleteAll(DatastoreService datastore, PreparedQuery results) { datastore.delete(entityKey); } } - + } diff --git a/portfolio/src/main/webapp/index.html b/portfolio/src/main/webapp/index.html index 8938dec..72c1a67 100644 --- a/portfolio/src/main/webapp/index.html +++ b/portfolio/src/main/webapp/index.html @@ -51,14 +51,13 @@

About Me

Hello! My name is Zachary, I am a rising junior at the University of Waterloo, Canada pursuing a major in Combinatorics & Optimization and a minor in Computer Science.
Feel free to click on the other tabs for more not-so-exciting information about me. -



-
+


-
+


-
+


Picture of Meme diff --git a/portfolio/src/main/webapp/libraries.css b/portfolio/src/main/webapp/libraries.css index 1606d7a..0f4d6dc 100644 --- a/portfolio/src/main/webapp/libraries.css +++ b/portfolio/src/main/webapp/libraries.css @@ -1,4 +1,4 @@ -#coronavirus-chart { +.chart { border: thin solid black; display: inline-block; } @@ -10,16 +10,6 @@ display: inline-block; } -#pie-chart { - border: thin solid black; - display: inline-block; -} - -#regions-chart { - border: thin solid black; - display: inline-block; -} - #comments-form { display: none; } diff --git a/portfolio/src/main/webapp/libraries.js b/portfolio/src/main/webapp/libraries.js index db95264..c533199 100644 --- a/portfolio/src/main/webapp/libraries.js +++ b/portfolio/src/main/webapp/libraries.js @@ -12,10 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +google.charts.load('current', { 'packages': ['corechart'] }); +google.charts.setOnLoadCallback(drawPieChart); +google.charts.setOnLoadCallback(drawRegionsChart); +google.charts.setOnLoadCallback(drawCoronavirusChart); + +// Coordinates of the University of Waterloo from manually checking Google Maps +const UWATERLOO = { lat: 43.473, lng: -80.545 }; +// Show all the main buildings of the University of Waterloo +const ZOOM = 16; +// Match height and width to other visual elements on the About Me tab +const DEFAULT_WIDTH = 700; +const DEFAULT_HEIGHT = 500; + function createMap() { - const uWaterloo = { lat: 43.473, lng: -80.545 }; - const map = mapInit(uWaterloo); - const marker = createMapMarker(map, uWaterloo); + const map = mapInit(UWATERLOO); + const marker = createMapMarker(map, UWATERLOO); changeMapToTerrain(map); createMapInfoWindow(map, marker); } @@ -24,9 +36,8 @@ function mapInit(position) { const map = new google.maps.Map( document.getElementById('map'), { center: position, - zoom: 16 - } - ); + zoom: ZOOM + }); return map; } @@ -43,21 +54,21 @@ function changeMapToTerrain(map) { } function createMapInfoWindow(map, marker) { - const contentString = '

' + - '
' + - '
' + - '

University of Waterloo

' + - '
' + - '

The University of Waterloo (commonly referred to as Waterloo, UW, or ' + - 'UWaterloo) is a public research university with a main campus in Waterloo, Ontario, ' + - 'Canada. The main campus is on 404 hectares of land adjacent to Uptown Waterloo and Waterloo ' + - 'Park. The university also operates three satellite campuses and four affiliated university ' + - 'colleges.

' + - '

Attribution: University of Waterloo, ' + - 'https://en.wikipedia.org/wiki/University_of_Waterloo ' + - '(last visited June 8, 2020).

' + - '
' + - '
'; + const contentString = `
+
+

University of Waterloo

+
+

The University of Waterloo (commonly referred to as Waterloo, UW, or + UWaterloo) is a public research university with a main campus in Waterloo, Ontario, + Canada. The main campus is on 404 hectares of land adjacent to Uptown Waterloo and Waterloo + Park. The university also operates three satellite campuses and four affiliated university + colleges. +

Attribution: University of Waterloo, + + https://en.wikipedia.org/wiki/University_of_Waterloo + (last visited June 8, 2020). +

+
`; const infoWindow = new google.maps.InfoWindow({ content: contentString }); @@ -66,11 +77,6 @@ function createMapInfoWindow(map, marker) { }); } -google.charts.load('current', { 'packages': ['corechart'] }); -google.charts.setOnLoadCallback(drawPieChart); -google.charts.setOnLoadCallback(drawRegionsChart); -google.charts.setOnLoadCallback(drawCoronavirusChart); - function drawPieChart() { const data = new google.visualization.DataTable(); data.addColumn('string', 'Animal'); @@ -83,8 +89,8 @@ function drawPieChart() { const options = { 'title': 'Zoo Animals', - 'width': 700, - 'height': 500 + 'width': DEFAULT_WIDTH, + 'height': DEFAULT_HEIGHT }; const chart = new google.visualization.PieChart(document.getElementById('pie-chart')); @@ -104,8 +110,8 @@ function drawRegionsChart() { const options = { 'title': 'Sample Regions Chart', - 'width': 700, - 'height': 500 + 'width': DEFAULT_WIDTH, + 'height': DEFAULT_HEIGHT }; const chart = new google.visualization.GeoChart(document.getElementById('regions-chart')); @@ -113,7 +119,8 @@ function drawRegionsChart() { } function drawCoronavirusChart() { - fetch('/coronavirus-data').then(response => response.json()) + fetch('/coronavirus-data') + .then(response => response.json()) .then((coronavirusCases) => { const data = new google.visualization.DataTable(); data.addColumn('string', 'Country'); @@ -124,8 +131,8 @@ function drawCoronavirusChart() { const options = { 'title': 'Coronavirus Cases', - 'width': 700, - 'height': 500, + 'width': DEFAULT_WIDTH, + 'height': DEFAULT_HEIGHT, 'colorAxis': { colors: ['lightcoral', 'darkred'] }, 'backgroundColor': 'lightblue', 'datalessRegionColor': 'white',