有没有办法在D3中生成20多种颜色? [英] Is there a way to generate more than 20 colors in D3?

查看:277
本文介绍了有没有办法在D3中生成20多种颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 D3 Wiki .有一个比例函数d3.scale.category20()

According to the D3 Wiki. there is a scale function d3.scale.category20() that

构造一个新的序数表,范围为20个分类 颜色:

Constructs a new ordinal scale with a range of twenty categorical colors:

问题:有什么办法可以产生20多种独特的颜色?我希望至少能达到50.

Question: is there anything that one can do to generate more than 20 unique colors? I was hoping to get at least 50.

推荐答案

通过查看您应该能够在自己的颜色列表中调用d3.scale.ordinal().range(...).

You should be able to call d3.scale.ordinal().range(...) on your own color list.

这篇关于有没有办法在D3中生成20多种颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆