Just started to learn Observable and need help explaining the following error:
chart = Error: invalid position
Notebook: Interactive Slope Chart / Stephan Haycock | Observable
Any explanation or advice would be appreciated.
Just started to learn Observable and need help explaining the following error:
chart = Error: invalid position
Notebook: Interactive Slope Chart / Stephan Haycock | Observable
Any explanation or advice would be appreciated.
As noted by the red caret, the error comes from the dodge
function here:
if (!positions.every(isFinite)) throw new Error("invalid position");
Using the debugger, it looks like you are passing an array of undefined values to the dodge function:
[undefined, undefined, undefined, undefined, undefined, undefined]
My guess from the code is that you are calling dodge
three times, once for each of the data.columns
which is ["Name", "Race1", "Race2"]
. But, the values
array in your data only has two elements (presumably for Race1 and Race2). So the third time you are passing undefineds, and hence the dodge
function is throwing an error.