From 43153a1a893c1fb9808aef62a2a46650b4faf3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gonz=C3=A1lez=20Arag=C3=B3n?= Date: Tue, 8 Oct 2024 12:53:31 -0600 Subject: [PATCH 1/2] Some sugested changes --- indexSalaries.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/indexSalaries.html b/indexSalaries.html index 0aa4df8..49ca2ee 100644 --- a/indexSalaries.html +++ b/indexSalaries.html @@ -12,13 +12,26 @@ // Load the Visualization API and the corechart package. google.charts.load('current', {'packages':['corechart']}); // Set a callback to run when the Google Visualization API is loaded. - google.charts.setOnLoadCallback(drawChart); +// NOTE: I've commented this function because cause an error due to the drawChart's parameter is not defined + //google.charts.setOnLoadCallback(drawChart); // get data from url let data = null; let url = "https://pollysnips.s3.amazonaws.com/bostonEmployeeSalaries.json" fetch(url).then((response) => response.json()) .then(json => { + /** + --------------------------------------------------------------------------------------------- + NOTE: I've added the following lines to enable the analyzeData button once the data is loaded + Also, I've added a loading message that hiddes once the data is loaded + --------------------------------------------------------------------------------------------- + **/ + analyzeData_btn = document.getElementById("analyzeData_btn") + loading_msg = document.getElementById("loading_msg") + loading_msg.hidden = true; + analyzeData_btn.disabled = false; + /** End of the added lines **/ + data = json; //writeData(JSON.stringify(data.data[0])); }) @@ -39,9 +52,12 @@

Boston City Valued Workers

+ +

Loading Data

- + +
From 876018cefdc5d6ef838dcaf51bf419117d54e3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gonz=C3=A1lez=20Arag=C3=B3n?= Date: Tue, 8 Oct 2024 12:58:32 -0600 Subject: [PATCH 2/2] Changing the initial loading of the data --- indexSalaries.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indexSalaries.html b/indexSalaries.html index 49ca2ee..a7d2b81 100644 --- a/indexSalaries.html +++ b/indexSalaries.html @@ -33,6 +33,8 @@ /** End of the added lines **/ data = json; + // I've added this line to call the analyzeData function once the data is loaded + analyzeData() //writeData(JSON.stringify(data.data[0])); }) .catch(error => {