简体   繁体   中英

Coloring hexbin series with d3js

I have a problem with coloring hexbin mesh using d3js. I'm plotting the hexbin series without a problem. But I want for each series a different color gradient. I don't know how to do that.

jsbin https://jsbin.com/zogohap/edit?js,output

Take a look at this block

  var body = d3.select("body"),
    length = 100,
    color = d3.scale.linear().domain([1,length])
      .interpolate(d3.interpolateHcl)
      .range([d3.rgb("#007AFF"), d3.rgb('#FFF500')]);


  for (var i = 0; i < length; i++) {
    body.append('div').attr('style', function (d) {
      return 'background-color: ' + color(i);
    });
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM