I set the ordinal scale in D3.js as follows, and it works well so far:
var color = d3.scale.ordinal().range([ 'blue', 'red', 'green' ]);
color.domain();
console.log(color(0));
Nevertheless, I would really like for me to be able to convey two numbers on the scale and return it under a shade of blue, red or green - the main shade depending on the first number, shade depending on the second number.
Perhaps I can combine d3.scale.ordinal () with d3.interpolateRgb () in some way to do this? I am not sure if interolateRgb is the right choice, because it is important that the colors are consistent, depending on the input numbers.
So here is what I would like to achieve:
color(0, 256); // return a shade of blue
color(0, 257); // return a second shade of blue
color(0, 256); // return the first shade of blue again
D3? .