How do I change the color of lines in a d3 line chart, for example in Mike Bostock\'s multi-series D3 line chart.
In his example chart, Mike Bostock uses D3\'s built
for D3 v4
let color = d3.scaleOrdinal()
.domain(["New York", "San Francisco", "Austin"])
.range(["#FF0000", "#009933" , "#0000FF"]);
You're only missing the square brackets around the values in .range()
-- it takes an array as argument. So the code should be
var color = d3.scaleOrdinal() // D3 Version 4
.domain(["New York", "San Francisco", "Austin"])
.range(["#FF0000", "#009933" , "#0000FF"]);
Complete example here.