Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems with chord.js in a non-observable environment #25

Closed
Nor-Sch opened this issue Apr 21, 2022 · 1 comment
Closed

problems with chord.js in a non-observable environment #25

Nor-Sch opened this issue Apr 21, 2022 · 1 comment

Comments

@Nor-Sch
Copy link

Nor-Sch commented Apr 21, 2022

The function range line 3-5 in chord.js does not work in a non-observable environment. It gives an array of "undefined" values.

Solution:

function range(i,j) { return [...Array(j-i).keys()].flatMap(j=>j+i) }

In line 100 of chord.js empty chords should be removed by chords = Object.values(chords);
But this also leaves e.g. "functions" in chords and breaks the compareValue function in lines 7-14

Solution:

chords = chords.filter(Object);
@mbostock
Copy link
Member

Nothing in d3-chord (or any D3 library) requires Observable. Here is an example in JSFiddle that demonstrates that the range function works as intended:

https://jsfiddle.net/yvng1h0o/1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants