How to customize the color scale in a D3 line chart?

后端 未结 2 1354
耶瑟儿~
耶瑟儿~ 2020-12-04 22:23

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

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 22:53

    for D3 v4

       let color = d3.scaleOrdinal()
          .domain(["New York", "San Francisco", "Austin"])
          .range(["#FF0000", "#009933" , "#0000FF"]);
    

提交回复
热议问题