LCA-ActivityBrowser / activity-browser

GUI for brightway2
GNU Lesser General Public License v3.0
149 stars 57 forks source link

SVG Sankey diagram #784

Open Hd1004 opened 2 years ago

Hd1004 commented 2 years ago

Some of the Sankey diagram Svg files downloaded are incomplete. The whole diagram doesn't get downloaded on some files.

marc-vdm commented 2 years ago

Could you provide screenshots of what's shown in AB and the files to compare?

Hd1004 commented 2 years ago

Screenshot (333) Screenshot (332) The downloaded SVG file only shows the first four steps of the diagram but you can see the whole diagram in the other file which is on AB

marc-vdm commented 2 years ago

Could you share the full file here too? (Just drag/drop the file onto the comment box and it will upload automatically). Then I could have a look at the file in more detail, I'm not sure something went wrong with your file specifically or that there is an issue with AB.

Hd1004 commented 2 years ago

desrgerg This is the downloaded file. I hope it helps

marc-vdm commented 2 years ago

Right, that's indeed broken.

@nabilahmed739 Could you have a look at the exporter? I''ll also look into behaviour, but I'm not sure I can fix this code alone

marc-vdm commented 2 years ago

@nabilahmed739 tried a bunch of random processes and cutoff/calc. depth settings but mostly got expected results. However, I'm getting a broken export when I use the (I think) same product as @Hd1004 (also note that the title with ref. flow is not present in their screenshot):

image I used: biogas production from grass | CH | ei38 For impact category I used IPCC2013 Climate change GWP100 The cutoff/calc. depth are in screenshot When I use the default cutoff/calc. depth the export is fine. Resulting SVG is: svg_export_test7

The SVG looks very similar to the red 'viewport' thing in the bottom left, but is not matching exactly. I now also notice that the viewport does not match with what is actually displayed, perhaps this could be the same issue?

Hd1004 commented 2 years ago

So, is it a bug or is something wrong with my version or the file?

marc-vdm commented 2 years ago

This seems to be a bug on AB side. Though it must also be related to very specific circumstances. I tried 5 different processes and made different combinations for the cut-off and calculation depth but could not replicate your issue with those, but when I tried your process (biogas production from grass | CH) and a smaller cut-off/larger calculation depth, I was able to replicate it.

It seems you found a rare/specific bug that didn't find before. We'll try to fix it, but for now, perhaps try a different (higher) cut-off for your export, though of course, that's not an ideal solution in the long run. Another alternative is to make screenshots, but that's also not a permanent fix.

Hd1004 commented 2 years ago

Okay, so not getting the cropped svg file for "IPCC 2013 Climate change GWP 20a" But getting those issues with "IPCC 2013 Climate change GWP 100a" and "ILCD 2.0 2018 midpoint, climate change, climate change total"

Hd1004 commented 2 years ago

And definitely an issue with "biogas production from grass | CH"

Hd1004 commented 2 years ago

So, the problem is certainly with a smaller cut-off/larger calculation depth. Because I am getting that error for every file with such depth.

marc-vdm commented 2 years ago

Well, interestingly enough, I'm now not getting the error with the same settings

Screenshot SVG

Perhaps try to re-start AB and see if the issue persists? This could also be caused by AB not properly resetting something after a re-calculation, thus breaking the exports, as it's now working for me after I restarted AB.

nabilahmed739 commented 2 years ago

@Hd1004 & @marc-vdm Apologies for the delayed response, there seems to be an issue with the exporter intermittently when the SVG is panned/zoomed. Have you tried "Reset Zoom" then "Download SVG"? This always worked for me. I'll try to reset the SVG before every export that way we dont have to press 2 buttons.

CHarpprecht commented 1 year ago

I am having the same issue. I had to scroll down a lot in the sankey diagram of the AB, such that the diagram is actually not visible anymore in the AB window. Only then, the exported SVG showed the entire diagram. Otherwise, it would only export the first third or so of the diagram.

My AB version is:

activity-browser-dev 2022.11.16

simb-sdu commented 1 year ago

Same issue here.

I opened the wrongly cropped svg file in inkscape, and it appeared that here, I could see the whole diagram - but it was outside the boundaries of the drawing. So I just extended the boundaries of the file in inkscape. So this seems to be a workaround

985