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

Upgrade d3 or use different graphing library for display (not capture) #180

Open
jywarren opened this issue Sep 29, 2020 · 7 comments
Open

Comments

@jywarren
Copy link
Member

Refactoring and using a new graphing library would be a lot of work, because we use d3 in the calibration routines and they are pixel-level CSS tuned with multiple complex drag interactions -- see https://publiclab.org/wiki/spectral-workbench-calibration#Video

However, we have identified a problem with d3 v3.5.17 and have had to revert to v3.4.0. The error is:

image

Uncaught TypeError: Cannot read property 'id' of undefined
    at SVGGElement.<anonymous> (spectral-workbench.js:5374)
    at SVGGElement.o (d3.min.js:1)
    at d3.min.js:3
    at Y (d3.min.js:1)
    at Array.Co.each (d3.min.js:3)
    at Array.Co.attr (d3.min.js:3)
    at _graph.load (spectral-workbench.js:5373)
    at Object.success (spectral-workbench.js:127)
    at c (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)

The revert is in #175, after initially bumping in #165.


Perhaps we could stop using nvd3 (https://nvd3.org/) which is not compatible with modern d3 (v5 for example and maybe v4), and then could get d3 up to a more recent version.

But we should really start by moving the calibration routine out of the Ruby on Rails SpectralWorkbench.org project and into this repo. The script for calibration UI (as in the video linked at top) is:

https://github.com/publiclab/spectral-workbench/blob/98dbde7a881788f7bd48db59eee616d6de70054b/app/assets/javascripts/analyze.js#L52-L60

https://github.com/publiclab/spectral-workbench/blob/98dbde7a881788f7bd48db59eee616d6de70054b/app/assets/javascripts/analyze.js#L122-L143

Lot of work here, but worthwhile!

@jywarren
Copy link
Member Author

Ahhh, i see-- we upgraded d3 to v3.5.x to get past this issue in v3.4.13 -- #162 (comment)

So, that issue is blocking us...

@jywarren
Copy link
Member Author

Noting this was caught by @sidntrivedi012 in #77 (comment)

and it's actually d3's dependency of an old version of jsdom that is requiring contextify and causing the error.

Here is where d3 upgraded to a newer jsdom: d3/d3#570

@jywarren
Copy link
Member Author

Oh, that's not right, that's d3 v2.8.0... looking deeper...

@jywarren
Copy link
Member Author

OK, then here, they went to JSDOM 7/8: d3/d3#2596

@jywarren
Copy link
Member Author

And here, they mention specifically the d3 v3.4 and v3.5 threshold: d3/d3#2578 (comment) and jsdom as a dev dependency...

@jywarren
Copy link
Member Author

We could try requiring [email protected] ...

@jywarren
Copy link
Member Author

OK, first version of d3 to make JSDOM optional is actually v3.5.4 (d3/d3#2225)... trying in #175

@jywarren jywarren added this to the Near-term goals milestone Jul 27, 2021
@jywarren jywarren changed the title Upgrade d3 or use different graphing library Upgrade d3 or use different graphing library for display (not capture) Jul 27, 2021
@jywarren jywarren removed this from the Near-term goals milestone Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant