I want to use different color for each data point in Scatter component, like using different color for each slice in Pie component.
I tested Cell child in Scatter component but it doesn't work. I also read Scatter.js source and it seems this component find all Cell children. Would you please help me to draw scatter diagram with colorful points?
@alishir Yeah, It's supported now.
<ScatterChart width={400} height={400} margin={{ top: 20, right: 20, bottom: 0, left: 20 }}>
<XAxis type="number" dataKey="x" name="stature" unit="cm" />
<YAxis type="number" dataKey="y" name="weight" unit="kg" />
<CartesianGrid />
<Tooltip />
<Legend/>
<Scatter name="A school" data={data01} fill="#ff7300">
{
data01.map((entry, index) => {
return <Cell key={`cell-${index}`} fill={colors[index % colors.length]} />
})
}
</Scatter>
</ScatterChart>
Most helpful comment
@alishir Yeah, It's supported now.