LoginSignup
14
15

More than 5 years have passed since last update.

D3.jsを使って50色のカラーセットを作成する

Posted at

都道府県を色で塗り分けるのに47色作るのが面倒だったのでd3.jsを使って色の配列を作成した。

    var shuffle = function() {return Math.random()-.5};
     //ランダムに50色のカラーリストを作成する
    var color =d3.scale.category20b();
    var color2 = d3.scale.category20();
    var color3 = d3.scale.category10();
    var cl = color.range();
    var colorList = cl.concat( color2.range() );
    colorList = colorList.concat(  color2.range() );
    console.log( colorList.sort(shuffle) );

以下の記事で使用。
【D3.js】グラフと地図を連動させる

14
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
15