DomParfitt / graphviz-react

React component for displaying Graphviz graphs
MIT License
102 stars 21 forks source link

Fill and resize with parent container #11

Closed jiahaowu closed 5 years ago

jiahaowu commented 5 years ago

This component is very useful. One question is that if I want to resize the canvas (Graphviz component) with its parent container rather than setting a fixed width and height., do you have any idea how to archive this ?

BTW, it might worth to mention that one needs to add --max_old_space_size=4096 option in their start script to make the component run properly in the documentation because it takes me quit some time to figure this out at very beginning.

jiahaowu commented 5 years ago

I noticed that there is options of

height: 800,
width: 600,

However, those values are by pixels, it might be helpful to allow setting them by percentage.

DomParfitt commented 5 years ago

Thanks for the feedback.

As far as I'm aware the underlying package for this component (d3-graphviz) only provides the option to set the width and height in pixels, not as a percentage. This component is only a thin wrapper over d3-graphviz so if this is a feature that you would benefit from then I would suggest raising an issue on that package. I think it makes more sense that any implementation would exist there rather than here as, in my opinion, the API for this package should very closely, if not perfectly, match that of d3-graphviz so it doesn't make sense to implement the functionality here.

Regarding the memory issue requiring the --max_old_space_size=4096 flag to be set, I had noticed it when I was putting together the documentation but didn't dig too deeply into the root cause. I'll add a note about it in the README and see if there's a more permanent fix for it when I get a chance.

jiahaowu commented 5 years ago

Thanks for the explanation. I will look into d3-graphviz to see if there is a workaround.

magjac commented 5 years ago

Regarding the memory issue; there might be some insight from https://github.com/magjac/graphviz-visual-editor/issues/95 or https://github.com/magjac/d3-graphviz/issues/94#issuecomment-497283784