I have a project that is due in just a few hours and I need to create a detailed chart using a large set of 64382 lines of JSON data. My knowledge of javascript is limited, so I am struggling to come up with ideas on how to approach this task. While I have created charts using javascript before, they only involved a minimal amount of data (3 lines). The type of chart I am aiming to create is more akin to something you would see in Excel rather than a typical bar or pie chart. I will include the code for the chart I previously made using 3 lines of data below.
Unfortunately, I haven't found any resources that clearly explain how to extract JSON data using a for loop. I believe this method could be useful in handling such a vast amount of information. For example, iterating through the data with a for loop like: for (i=0; i < data.length; i = i+1) { ... } However, I am struggling to understand how to integrate this data into my chart creation process. Additionally, I need to ensure that there are no duplicates from countries like Afghanistan or Canada, which requires specific code implementation.
<div id="printmytable"></div>
<script>
function buildmyTable() {
var inventors = [{name:"Tim Berners-Lee",invention:"6xU & HTML"},{name:"Haken Wium Lie",invention:"CSS"},{name:"Brendan Eich",invention:"Javascript"}];
// building a string variable including all table codes and data
var mytable = "<table border='1'>";
mytable = mytable + "<th>Inventor</th><th>Invention</th>";
// looping through the data table to add information
for (i = 0; i < inventors.length; i = i + 1) {
mytable = mytable + "<tr>";
mytable = mytable + "<td>" + inventors[i].name + "</td><td>" + inventors[i].invention + "</td>";
mytable = mytable + "</tr>";
}
mytable = mytable + "</table>";
// obtaining the div element and substituting mytable data within it
var placetoprint = document.getElementById("printmytable");
placetoprint.innerHTML = mytable;
}
buildmyTable()
</script>
I am looking to create a chart resembling an Excel-based visualization where each country is represented uniquely without any duplicates. My current knowledge on this topic is limited, leaving me unsure about how to proceed effectively.