colorByID2 = (objectSet,dataList,objectIDfield,dataIDfield,dataValueField,weights,extents,colorScaleColors) => {
var combined = {};
for (let index = 0; index < 7; ++index) {
let data = dataList[index];
data.forEach(d =>{
if (!(d[dataIDfield] in combined)){
combined[d[dataIDfield]] = 0;
}
combined[d[dataIDfield]] += weights[index] * toNum(d[dataValueField]);
})
}
let minValue = -1;
let maxValue = -1;
let firstValue = true;
for (const property in combined){
if (firstValue){
minValue = combined[property];
maxValue = combined[property];
firstValue = false;
}
else {
if(combined[property] < minValue){
minValue = combined[property];
}
if(combined[property] > maxValue){
maxValue = combined[property];
}
}
}
let colorScale = d3.scaleLinear().domain([minValue, maxValue]).range(colorScaleColors)
for (const property in combined){
objectSet.filter(o=>o[objectIDfield] == property)
.style("fill",colorScale(combined[property]))
}
}