Trying to create Plugin for simple charts

Hii Im trying to create plugin using react and recharts, Eg where if user clicks on LineChart button on panel line chart should appear on the artboard. But I’m not able to render dynamic components to scenegraph (using recharts).
Is there any way to do it???

Looks like recharts is SVG-based, so if you can get it to produce the SVGs in your dialog/panel DOM, you’d have to translate those SVGs yourself into XD scenegraph elements.

It’s possible that if you got the SVG source on the clipboard, that the user could paste that SVG into XD, but that’s of course a hacky workaround.

2 Likes

You can also use Drag & Drop to allow the user to drag a chart into the canvas. The SVG must be saved to a file in order for this to work, but that might work for you.

1 Like

That reminds me: How soon could we get a “paste SVG to scenegraph here” kind of API? Seems like the code is already there…

Beside Drag and Drop is there a way to insert an SVG image into the artboard? Something like ImageFill?

ImageFill takes only jpeg, png, gifs no SVGs, I did try but i couldn’t get svgs into ImageFill.