trademapper / trademapper-js

JS libraries for mapping trade using d3.js
Other
26 stars 18 forks source link

Export PNG (and the rest) #79

Closed townxelliot closed 5 years ago

townxelliot commented 5 years ago

While doing this, I had to fix the SVG sizing during export so that the PNG doesn't crop the edges off the image.

This had a knock-on effect of making the SVG larger, which then meant the GIF export ground to a halt, as it was dealing with frames which were twice as big.

I went back to gif.js, as this copes better with larger frames. I also updated the progress bar to report on the progress of the render, as gif.js provides an (undocumented) "progress" event. And I messed around with the different dithering methods to find the one which retains the node colours best. Another consequence of increasing frame size is that the colours and sharpness are generally better anyway, though the export is considerably slower. It's a trade-off...

I also fixed a few bugs which had cropped up somewhere along the way, and test breakages.