-
Notifications
You must be signed in to change notification settings - Fork 1
6. Experimenting with data visualisations in Excel
In order to find out what datavisualisation would work best the retrieved data, i first had to make sure the data was cleaned up a bit. I did this with the following functions:
function showResults(data) {
return data.results.bindings;
}
function loopData(data) {
return data.map(dataItem => deNestProperties(dataItem));
}
function deNestProperties(data) {
return Object.assign({}, data, {
cho: data.cho.value,
placeName: data.placeName.value,
title: data.title.value,
type: data.type.value.toLowerCase()
});
}
- showResults returns the array of objects with the results.
- loopLata maps the data with the function deNestProperties.
- deNestProperties takes the data and makes sure that the keys are correctly paired to the values
After this I used a function that took this clean data and turned it into a Json string using: JSON.stringify();
function makeJson(data) {
return console.log(JSON.stringify(data));
}
After this i found a converter tool to convert JSON to csv called: json-csv. With the output of the function in the console of my browser, I could copy-paste it into the json-csv converter. Afterwards the tool gives you the option to download the output of your json input as a .csv
or .xslx
. I downloaded the .xslx
since i was gonna experiment in Excel anyways.
After trying out my first concept, which was a barchart, I tried making a piechart and other charts to see what visualisation would be best to represent the data. I couldn't find any visualisation that would visually represent the data well with Excel. So i looked up some charts online and quickly stumbled upon a bubble chart. Using a bubble chart, you can easily see the difference in amount between weapon types, and it looks fun.