umap_data = umap_data_ini.map(
x => {
var inst_long = umap_x_scale(parseFloat(x['x']))
var inst_lat = umap_y_scale(parseFloat(x['y']))
var inst_food_type = food_type[x['']].split(': ')[1]
var rgb = d3.color(cat_colors[inst_food_type])
var inst_color
if (selection === 'category'){
var inst_alpha
if (selection_type == 'col-dendro'){
if (dendro_selections.includes(x[''])){
inst_alpha = 255
} else {
inst_alpha = 25
}
} else {
inst_alpha = 255
}
inst_color = [rgb.r, rgb.g, rgb.b, inst_alpha]
} else {
var inst_index = network.col_node_names.indexOf(x[''])
var inst_data = dimension_data[inst_index]
var inst_opacity = opacity_scale(Math.abs(inst_data))
if (inst_data > 0){
inst_color = [255, 0, 0, inst_opacity]
} else {
inst_color = [0, 0, 255, inst_opacity]
}
}
var inst_obj = ({
name: x[''],
position: [inst_long, inst_lat],
food_type: inst_food_type,
color: inst_color
})
return inst_obj
}
)