build/datagen.js
// transform csv2json array to id: {y_2012: value} object format
transform csv2json array to id: {y_2012: value} object format
transform csv2json array to id : { y_2012 : value } object format
function jsonTransform(jsonArray) {
  var jsonOut = {};
  for (var i = 0; i < jsonArray.length; i++) {
    jsonOut[jsonArray[i]['id']] = {};
    let keys = Object.keys(jsonArray[i]);
    let key = keys[keys.length - 1];
    if (isNumeric(jsonArray[i][key])) {
        jsonOut[jsonArray[i]["id"]][key] = Number(jsonArray[i][key]);
    } else {
        jsonOut[jsonArray[i]["id"]][key] = null;
    }
  }
  return jsonOut;
}
function jsonTransform ( jsonArray ) { var jsonOut = { } ; for ( var i = 0 ; i < jsonArray . length ; i ++ ) { jsonOut [ jsonArray [ i ] [ 'id' ] ] = { } ; let keys = Object . keys ( jsonArray [ i ] ) ; let key = keys [ keys . length - 1 ] ; if ( isNumeric ( jsonArray [ i ] [ key ] ) ) { jsonOut [ jsonArray [ i ] [ "id" ] ] [ key ] = Number ( jsonArray [ i ] [ key ] ) ; } else { jsonOut [ jsonArray [ i ] [ "id" ] ] [ key ] = null ; } } return jsonOut ; }
transform csv2json array to id: {y_2012: value} object format
transform csv2json array to id : { y_2012 : value } object format