admin管理员组文章数量:1296257
I have a set of numbers from 1 to 100 -- they're rankings, so 1 is greater than 2 (30 is greater than 100, etc.)
This is my color function right now:
var color = d3.scale.linear()
.domain([0, 100])
.range(colorbrewer.Reds[3]);
Except this maps 1's and 2's as the lighter shades or Red.
Any ideas how to go about this? I think my terminology (reverse? inverse color mapping?) is incorrect because I can't find this in the documentation.
Thank you.
I have a set of numbers from 1 to 100 -- they're rankings, so 1 is greater than 2 (30 is greater than 100, etc.)
This is my color function right now:
var color = d3.scale.linear()
.domain([0, 100])
.range(colorbrewer.Reds[3]);
Except this maps 1's and 2's as the lighter shades or Red.
Any ideas how to go about this? I think my terminology (reverse? inverse color mapping?) is incorrect because I can't find this in the documentation.
Thank you.
Share Improve this question asked Mar 25, 2015 at 21:51 fhbifhbi 7527 silver badges17 bronze badges 1- 1 have you tried simply reversing the domain values? EDIT: just saw your answer, glad you figured it out yourself :) – tomtomtom Commented Mar 25, 2015 at 21:55
1 Answer
Reset to default 12D'oh.
Reverse the domain .....
var color = d3.scale.linear()
.domain([100, 0])
.range(colorbrewer.Reds[3]);
YOLO
本文标签: javascriptReverse color mapping in d3Stack Overflow
版权声明:本文标题:javascript - Reverse color mapping in d3 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741631974a2389419.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论