Need help to generate the colors in chart
Problem : I am creating d3 chart - QQ plot, I want to add colors to each part of the chart. But I am not able to do it, so required help on this.
Thank you for your valuable time.
Any help is appreciated
Refrence. I am considering D3 QQ plot over protovis QQ plot due to ease of customisation.
Data will be binded in following code
var g = vis.selectAll("g")
.data([{
x: d3.range(n).map(Math.random),
y: turkers[0].percent.values,
label: "Uniform Distribution"
}, {
x: d3.range(n).map(normal1(tm, td)),
y: turkers[0].percent.values,
label: "Gaussian (Normal) Distribution"
}, {
x: d3.range(n).map(normal3(dd)),
y: turkers[0].percent.values,
label: "Mixture of 3 Gaussians"
}])
.enter().append("g")
.attr("class", "qq")
.attr("r", 5)
.attr("transform", function(d, i) {
return "translate(" + (width + margin.right + margin.left) * i + ")";
})

One possible solution (out of many) is selecting the circles inside each group:
In this case, the second argument (
i) is the index of each group, which I'm using to pass to a color scale.Here is the updated JSFiddle: https://jsfiddle.net/3bjwv36r/
And here the S.O. snippet: