I'm currently diving into D3 and facing an issue with some code written in an older version of the library. The data loading process has changed in version 5.7.0, and I'm struggling to make it work for this specific example. Loading data with just one function is clear to me, but handling two functions in this scenario is proving to be a challenge.
Could someone provide guidance on how to update this code to function properly with the latest version of D3? Here's the snippet:
function show() {
'use strict';
// load the data
var loadedData;
d3.csv('./data/businessFiltered.csv').then(
function(row) {
switch (row.yearsInBusiness) {
case "001" : row.yearsInBusinessLabel = "All"; break;
case "311" : row.yearsInBusinessLabel = "less than 2 years"; break;
case "318" : row.yearsInBusinessLabel = "2 to 3 years "; break;
case "319" : row.yearsInBusinessLabel = "4 to 5 years"; break;
case "321" : row.yearsInBusinessLabel = "6 to 10 years"; break;
case "322" : row.yearsInBusinessLabel = "11 to 15 years"; break;
case "323" : row.yearsInBusinessLabel = "more than 16 years"; break;
}
return row;
},
function (data) {
loadedData = data;
updateCircle();
}); ...