Slow progress on my alternative, but progress none-the-less:
The block colours are specified in a mapping table:
const categoryMap = [
{ range: [0, 0.3], title: "Off", color: "#ff0000" },
{ range: [0.3, 0.6], title: "Partial", color: "#ffff00" },
{ range: [0.6, 1], title: "On", color: "#00ff00" }
];
So you can use any numeric value in the input data and it automatically maps to an output name and colour.