Check out a free preview of the full Interactive Data Visualization with D3.js course:
The "Add Categorical Color Scales in d3.js" Lesson is part of the full, Interactive Data Visualization with D3.js course featured in this preview video. Here's what you'd learn in this lesson:
Ian Johnson, <a href="http://www.meetup.com/Bay-Area-d3-User-Group/">organizer of Bay Area d3</a> and creator of <a href="http://tributary.io/">tributary.io</a>, shows how to color a chart based on categorical data. He also sizes scatterplot points based on a range of number of comments in the data.