function filterData(apiData) {
var dataPoints;
for (var i = 0; i < apiData.length; i = i + 1) {
if (apiData[i].meta.n1 == "ogółem" && apiData[i].meta.n2 == "ogółem") {
dataPoints = apiData[i].data.results[0].values;
}
}
return dataPoints;
}
fetch("https://cors-anywhere.herokuapp.com/http://satyrium.pl:8080/work/media-3.0-datavis-course/data.json")
.then(function(data) {
return data.json()
})
.then(function(result) {
var filtered = filterData(result);
document.body.innerHTML = "<pre>" + JSON.stringify(filtered, null, 2) + "</pre>";
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.