import { select, arc, outerRadius, innerRadius, scaleOrdinal } from 'd3';
import {
dataSource1,
dataSource2,
proxyUrl,
selectedColumn,
} from './config.js';
// Get data from dataSource 2 (GEO PenR) and count all the years in the array
getData(dataSource2).then((RDWData) => {
console.log("all data: ", RDWData)
const locationArray = filterData(RDWData, selectedColumn);
console.log('All location data', locationArray);
// Thanks to @Razpudding / Laurens
let aantalPerJaarArray = [];
locationArray.forEach((jaar) => {
// if the array includes a empty value, change it to 0
// else make a new array with all the years + number of values
if (aantalPerJaarArray.find((item) => item.year == jaar) == undefined) {
aantalPerJaarArray.push({
year: jaar,
value: 0,
});
}
// Count for every found item 1 to the value
aantalPerJaarArray.find((item) => item.year == jaar).value += 1;
});
// Unique values
const uniqueAreaValues = listUnique(locationArray);
console.log('Unique area values:', uniqueAreaValues);
makePieChart(aantalPerJaarArray);
});