Currently experiencing a puzzling moment.
I'm attempting to insert more information into my object after retrieving it from an external source (just for testing purposes, I intend to add random values).
Without further ado:
As an example, here is what my test.json
file looks like:
[["month",[-150,100,0.7]]]
After obtaining the JSON
file, I want it to resemble this:
[["month",[-150,100,0.7,24,24,0.5]]]
Request:
xhr = new XMLHttpRequest();
xhr.open('GET', '/test.json', true);
xhr.onreadystatechange = function(e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var data = JSON.parse(xhr.responseText);
// Attempting to include this as an additional array
data[0].push([24,24,0.5]);
window.data = data;
for (i=0;i<data.length;i++) {
globe.addData(data[i][1], {format: 'magnitude', name: data[i][0], animated: true});
}
globe.createPoints();
settime(globe,0)();
globe.animate();
document.body.style.backgroundImage = 'none'; // remove loading
}
}
};
xhr.send(null);
This is the hierarchy I observe using dev tools
:
The data is being inserted deeper into the structure... I'm somewhat uncertain how to organize this.
(Working on a project involving the WebGL - Globe Google Project, FYI)
Is there a simpler way to handle a dataset than manually adding each value like...?
data[0][1].push(24);
data[0][1].push(24);
data[0][1].push(0.5);