xxxxxxxxxx
26
let table;
function preload() {
//my table is comma separated value "csv"
//and has a header specifying the columns labels
table = loadTable("airpollution.csv", "csv", "header");
}
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB);
const ubg = table.getColumn("Urban_Background");
background(255);
noStroke();
let margin = 20
let distance = width - 140;
let gap = distance / ubg.length;
for (let i = 0; i < ubg.length; i++) {
let hue = map(ubg[i], 15, 54, 60, 360);
fill(hue, 100, 100, 0.2);
square(margin + i * gap, 0, ubg[i] * 10);
}
}