[英]D3 lineRadial - what is the math behind this?
I am trying to make sense of this snippet我试图理解这个片段
const radialScale = d3Scale.scaleLinear()
.domain([0, 1])
.range([0, this.radius]);
const line = d3Shape.lineRadial()
.angle((d) => {
// Angle position
return d[0];
})
.radius((d) => {
// Distance from center
return radialScale(d[1]);
});
that I call in我打来的
console.log(d);
const coors = line([[d.angle, d.radius]]).slice(1).slice(0, -1);
console.log(coors);
with those values:使用这些值:
first log:
angle: 3.6215581978882336, radius: 14.3
second log:
-1122.510878774367,2156.323335456257
and my head does not wrap around the return values of the function.并且我的头脑没有围绕函数的返回值。 I my specification above it should return d[0]
- ie 3.621....
, yet I get -1122.510878774367
?我上面的规范应该返回d[0]
- 即3.621....
,但我得到-1122.510878774367
? The / A documentation I found for lineRadial
states it should simply return radians, and my d[0]
is a radian value.我为lineRadial
找到的 /A 文档指出它应该简单地返回弧度,而我的d[0]
是一个弧度值。
https://www.geeksforgeeks.org/d3-js-lineradial-angle-method/https://www.geeksforgeeks.org/d3-js-lineradial-angle-method/
Not sure what I am getting wrong with this function...不知道我对这个功能有什么问题......
Any ideas?有任何想法吗?
It was that I had the radialScale
function wrong, so my radius value went out of the roof.是我的radialScale
函数错了,所以我的半径值超出了屋顶。 I had to adjust that and plots now look good.我不得不调整它,现在情节看起来不错。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.