I have a function that renders a d3 graph. But here I want to make the color dynamic taking input from front end. So parameter would an option for me.
function chart(colorX){
const color = d3.scaleOrdinal(d3.quantize(d3.interpolateRainbow, mainData.children.length + 2));
}
Here interpolateRainbow is the d3 function that I want to make as a parameter input.
if I use colorX
const color = d3.scaleOrdinal(d3.quantize(d3.colorX, mainData.children.length + 2));
it throws error.
Anyone can help me with this plz?