This post describes how to build a grouped scatter plot with d3.js. It follows the previous basic scatterplot. It extends it by adding a color scale linked with a categoric variable: each group will thus appear with a different color on the chart.
scaleOrdinal,
attributing a different color for each group. See more about
color scale here.
fill style of circles is set.