dbt-labs / dbt-docs

Auto-generated data documentation site for dbt projects
Apache License 2.0
141 stars 75 forks source link

[CT-794] Export Lineage Graph as SVG or PDF #283

Open nelsoncardenas opened 2 years ago

nelsoncardenas commented 2 years ago

Describe the feature

Problem: if we want to generate an image for our Lineage Graph, there is the option to export the graph as PNG, but this image has no quality options. Example: image

image

To add more flexibility, dbt can allow generating not just the PNG, but an SVG or PDF file with vectorized images. Reference: Scalable Vector Graphics

Describe alternatives you've considered

You can try to add PNG configurations as ppi and dimensions, but a scalable image format is a more general solution.

Who will this benefit?

Are you interested in contributing this feature?

Maybe, but I'm not so familiar with the dbt repo.

jtcohen6 commented 2 years ago

@nelsoncardenas Sorry for the delay getting back to you!

The logic for the graph export is neatly self-contained in just a few lines of code. We use the cytoscape library's built-in .png() function to create a PNG here:

https://github.com/dbt-labs/dbt-docs/blob/85dec858c5d213699fbc2cefa388ba1e80c94889/src/app/components/graph/graph-viz.js#L210-L214

It looks like the cytoscape library has built-in support for PNG, JPG, and JSON as export options (no SVG): https://js.cytoscape.org/#core/export

But it also looks like someone has developed an extension to the cytoscape library, for SVG exports: https://github.com/kinimesi/cytoscape-svg

Is that something you'd be interested in experimenting with?

nelsoncardenas commented 2 years ago

Thanks, @jtcohen6, I'll need to study how to contribute to the project. Also, my JavaScript skills are basic, I'm a python developer (machine learning engineer). But I'd like to work on this issue and I can ask for help from some friends maybe.

abhijithp05 commented 1 year ago

@nelsoncardenas @jtcohen6 Is this still open?

nelsoncardenas commented 1 year ago

@abhijithp05 sorry, I have been busy, and I don't think I'll have any time soon to work on this issue.

abhijithp05 commented 1 year ago

@nelsoncardenas Created a PR for the issue. Please review. and merge

github-actions[bot] commented 8 months ago

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

nelsoncardenas commented 8 months ago

@nelsoncardenas Created a PR for the issue. Please review. and merge

I cannot approve that PR (https://github.com/dbt-labs/dbt-docs/pull/365), maybe drewbanin can give us some help here.