Uh oh!
There was an error while loading. Please reload this page.
plotly-graph: add support for JSON exports - #309
Conversation
| const imgOpts = { | ||
| format: (PRINT_TO_PDF || PRINT_TO_EMF) ? 'svg' : format, | ||
| format: (PRINT_TO_PDF || PRINT_TO_EMF) ? 'svg' : (format === 'json' ? 'full-json' : format), |
There was a problem hiding this comment.
This is getting a bit tortured... I would recommend hoisting this out into a little sequence of ifs or a switch or something :)
nicolaskruchten
commented
Apr 7, 2020
Could we see a real mock that shows a trivial figure like |
Here's the output for mock Here's the output mock for a trivial figure |
Uh oh!
There was an error while loading. Please reload this page.
nicolaskruchten
commented
Apr 7, 2020
OK but are we committing the output of the mock 29 JSON into the repo and comparing it each time etc? |
antoinerg
commented
Apr 7, 2020
At the moment, no we don't have JSON baselines (see #309 (comment)). It could be added later once we support deterministic identifiers in plotly.js. |
nicolaskruchten
commented
Apr 7, 2020
What is nondeterministic about the JSON for the blank figure? |
antoinerg
commented
Apr 7, 2020
For the blank figure, it seems like it will be deterministic. Actually, the only thing that will be nondeterministic in the JSON for non-trivial figures will be the |
nicolaskruchten
commented
Apr 7, 2020
I'd love to see at least one full json-to-fullJson mock-to-baseline in the test suite for Orca moving forward, yes. The blank figure is a good start! |
After pinning all the mock's |
| case "$format" in | ||
| json) | ||
| diff "$1/$filename" "$2/$filename" > "$3/$filename.diff" |
There was a problem hiding this comment.
do you want to do a more JSON-aware kind of diff here, or does the JSON that comes out of Orca already have sorted keys ?
There was a problem hiding this comment.
The order seems to be deterministic so it's not strictly necessary. If that ever changes, I will add JSON-aware diffing. It would be a nice addition indeed.
There was a problem hiding this comment.
If it comes to that we could install and run https://www.npmjs.com/package/json-diff. I went with built-in diff for the time being.
nicolaskruchten
commented
Apr 8, 2020
Looks solid! thanks for 🔒ing all that down so tight with the JSON comparisons! |
This PR adds support for JSON exports in plotly-graph following the release of plotly.js v1.53.0 and effectively closes#283
Baselines for the image tests had to be updated for them to pass (following changes introduced by bumping plotly.js from to
v1.47.2tov1.53.0)cc @nicolaskruchten@alexcjohnson@jonmmease