gpt4 book ai didi

javascript - 加热棒确保准确性

转载 作者:行者123 更新时间:2023-12-03 07:01:32 28 4
gpt4 key购买 nike

是否有一个 javascript 图表,看起来像这样:heat bar 您可以在其上放置一个点的准确性。那么,不是从黑到红,而是两端是红色,中间是绿色,而且距离中心越远,读数就越不准确?

最佳答案

我认为您正在寻找像这样的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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com