-1

当我尝试在字段半径和内部半径值中输入一个值时出现此错误(在实心仪表中,amchart)

错误:属性 d:预期数字,“M397,NaN L397,0 A0,0,...”。

我试图找到一些有共同错误的主题,但我没有找到任何东西。

我用于找到该值的两个函数是:

"radius": ( 5 + ( Math.floor( index / 2 ) * ( 100 / length ) ) ) + "%",
"innerRadius": ( ( Math.floor( index / 2 ) + 1 ) * ( 100 / length ) ) + "%"

问题是使用这个功能

"radius": (105 - ( Math.floor ( index / 2 ) * length ) ) + "%",
"innerRadius": ( 100 - ( Math.floor ( index / 2 ) * length ) ) + "%"

错误未显示。

4

1 回答 1

-1

我发现了错误。错误是当我用“%”设置半径和内半径值时。我也尝试使用 toFixed 方法,它可以正常工作

"innerRadius":  ( ( Math.floor( index / 2 ) + 1 ) * ( 100 / length ) ).toFixed(2) + "%" ,               

但是当我添加 ' + "%" ' 时,给我错误路径。但在它完美运行之前,或与其他公式。我也尝试使用 toString() 方法,但它没有用。

于 2020-01-17T09:53:12.270 回答