EnzymeFunctionInitiative / efi-web

Replaces the est-web and gnt-web repositories by unifying them into a single repo.
0 stars 3 forks source link

Export images from sunburst diagrams #4

Open nilsoberg opened 7 months ago

nilsoberg commented 7 months ago

Add support for downloading images in SVG and PNG format from the EFI sunburst diagrams. Results should match what is currently displayed to the fullest extent possible. See results page with sunburst example for an example.

1ndy commented 7 months ago

image taxonomy(8)

Exporting as SVG and PNG is working, needs more testing to make sure it is stable; SVG seems ok but PNG sometimes produces blank images.

Testing so far has only been done by pasting my javascript functions into the console and calling an addDownloadLinks function manually; will need some integration testing once commits are made (js loading/ execution might happen in the wrong place in stepc.php).

1ndy commented 7 months ago

@nilsoberg I may need some help with integration testing this. I am not sure how to run a test version of the website.

nilsoberg commented 6 months ago

We talked about building our own minified/packaged version of the sunburst code rather than including the minified version itself in the repo. There are two ways we can avoid this: one is to use the unpkg.com CDN system (e.g. <script src="//unpkg.com/sunburst-chart"></script>), or build it from source. I lean towards using unpkg.com with a specific version number that works for us, and this means we don't need to install npm and worry about including that in the PHP package process. (The repo https://github.com/vasturiano/sunburst-chart shows that as the usage in the examples.) What are your thoughts?

1ndy commented 6 months ago

I'm not sure how either of these options are better than the current changes. Including the actual sunburst package with npm or a CDN does not give us anything we don't already have. The issue was that our version of the minified code does not correlate with the source code in our sunburst repository. (The minified code has a stylesheet that is critical for properly rendering the graphic, the source code in our sunburst repository does not.) I'm worried that there might be other inconsistencies in that repo, that's why the changes were made here (I didn't know we wanted export capabilities in other tools).

Are you proposing that we also submit a PR to the actual sunburst repo for image export? I'm not sure they would accept our changes given that they didn't seem interested in adding SVG export 2 years ago.