作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
最佳答案
我认为您正在寻找像这样的plot.ly colorscale:
https://plot.ly/javascript/heatmap-and-contour-colorscales/#hot-colorscale
如果这对您不起作用,并且您需要更多控制,您可以直接使用 d3.js 色标
http://synthesis.sbecker.net/articles/2012/07/16/learning-d3-part-6-scales-colors
var color = d3.scale.linear()
.domain([-1, 0, 1])
.range(["red", "white", "green"]);
color(-1) // "#ff0000" red
color(-0.5) // "#ff8080" pinkish
color(0) // "#ffffff" white
color(0.5) // "#80c080" getting greener
color(0.7) // "#4da64d" almost there..
color(1) // "#008000" totally green!
关于javascript - 加热棒确保准确性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37033667/
我是一名优秀的程序员,十分优秀!