JustinGOSSES / wellioviz

d3.js v5 visualization of well logs
https://justingosses.github.io/wellioviz/#introduction
Apache License 2.0
52 stars 12 forks source link

separate SVG appending to DIV from SVG creation function #22

Open JustinGOSSES opened 4 years ago

JustinGOSSES commented 4 years ago

separate SVG appending to DIV from SVG creation function

JustinGOSSES commented 4 years ago

Maybe this approach - https://gist.github.com/wboykinm/e6e222d71e9b59e8b3053e0c4fe83daf or https://d3export.housegordon.org/ or https://stackoverflow.com/questions/23218174/how-do-i-save-export-an-svg-file-after-creating-an-svg-with-d3-js-ie-safari-an but all of those are really written for front-end...

if the goal is pre-rendering server side, this slightly different approach might be better:

https://mango-is.com/blog/engineering/pre-render-d3-js-charts-at-server-side/

0r this one is a little easier but not sure it would still work: https://medium.com/@92sharmasaurabh/generate-svg-files-using-nodejs-d3-647d5b4f56eb

JustinGOSSES commented 4 years ago

Tried an approach in Observable and got a SVG file to be returned file download. This isn't actual sever side execution, only front-end however, so leaving this issue open.

EXAMPLE: https://github.com/JustinGOSSES/wellioviz/blob/master/docs/images/test2_SvgFileExport.svg

CODE: https://observablehq.com/@justingosses/well-log-in-d3-js-v5-notebook-2

Might have to change the code a bit more to get it to work on server side....will see