-1

i have this error when I try to put a value in the field radius and innerRadius value (in a Solid Gauge, amchart)

Error: attribute d: Expected number, " M397,NaN L397,0 A0,0,…".

I tried to find some topic with the error in common this but i didin't found anything.

The two functions that i use for found the value are:

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

The problem is using this function

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

The error is not shown.

khalD
  • 317
  • 5
  • 15
  • Check the values of `index` and `length` with a debugger (or `console.log`), to begin with. – Federico klez Culloca Jan 15 '20 at 15:27
  • the values are corrects. I already debug wih console.log – khalD Jan 15 '20 at 15:29
  • 1
    Let me rephrase my doubt: the only sensible difference, mathematically speaking, is that the first example contains a division by `length`, the second doesn't. So, are you sure that `length` is never 0? – Federico klez Culloca Jan 15 '20 at 15:31
  • I make some console.log for be sure and at the beginning the length is null but the error arrives after the change of the value (because the length changes dynamically). Also i tried to set the value > 0 and it has the same error. – khalD Jan 15 '20 at 16:12

1 Answers1

-1

I found the error. The error is when i set radius and innerRadius value with the "%". I tried to use toFixed method too, it works without errors

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

but when i add ' + "%" ' give me the error path. But before it works perfectly, or with others formula. Also i tried to use toString() methods too but it didn't work.

khalD
  • 317
  • 5
  • 15