react-d3-graph icon indicating copy to clipboard operation
react-d3-graph copied to clipboard

How to style the svg component?

Open henri-edinb opened this issue 4 years ago • 2 comments

Describe the solution you'd like Arbitrary CSS style of the SVG component. For instance, setting the background-color or border. Currently, only width and height are possible, maybe we could set the full SVG style in the config?

Describe your use case Want to set a background-color and border for the canvas and I'm able to do it in the browser by changing the style directly in the source code.

Describe alternatives you've considered I might try and add this feature myself if you point me in the right direction.

henri-edinb avatar Jan 15 '21 19:01 henri-edinb

Hi @henri-edinb ,

You could style a container div without having to style the graph for most props, example here : codesandbox.

Is this a good enough solution or do you need more customization?

antoninklopp avatar Jan 16 '21 19:01 antoninklopp

yeah i tried that, but sometimes it doesn't work very well because the svg component is smaller than the container.. i proposed a simple solution in issue #429 but I'm not sure that the solution is that simple, if it's more complex I guess its not really worth it to spend much time on it cause this div solution seems to work for most cases. thanks!

henri-edinb avatar Jan 16 '21 20:01 henri-edinb