Rendering to canvas
Hi,
I'm a Big fan of vx, I think it's an amazing take on how to build reusable graphs. As far as I know it doesn't allow rendering to canvas instead of svg and I was wondering if it was ruled out or if it is on the table for some day in the future?
Thanks!
Canvas support is still on the table. Here's a proof-of-concept prototype I did back in February: https://codesandbox.io/s/xorr68vzqz (final API subject to change, this was just an idea sketch).
I hope/plan to add canvas support in the future.
Canvas is more low level thinks and act directly to the pixels. The svg works fine so far. Did you find any performance issue to share it with us?
Hey @xargr, I had to make some research to decide on which to choose, and the answer is that SVG provides better performance with a larger surface or a smaller number of objects. Canvas provides better performance with a smaller surface or a large number of objects.
So depending on the amount of data you wanna put on a chart, it really has some performance improvements.
Hey @xargr, sorry for the late answer. On my side I really find vx awesome to use and we have some existing canvas visualisations. I was just wondering if porting them to vx could be an option. No particular performance issue with vx itself.
This would really be useful for calendar components, is there any movement on this?
No material updates on this, but I think it's definitely still on the table. Probably need to flesh out the implementation a bit more, likely could be implemented per-package (e.g., shape could export svg + canvas components)
Hey @williaster! Any update on this? Just tried to create a scatter plot using Visx and ran into some performance issues when using more than 1000 datapoints. I think I'll implement it using D3 instead but just wanted to check if you knew if someone is working on adding canvas support.
Still no updates that I know of
I made a POC of drawing the generated SVG into a canvas, and then swapping the SVG element for the canvas element. Seems to work fine. Used the following for the svg-to-canvas conversion: https://stackoverflow.com/a/45334496/3425536. So this is one possibility.
Any updates on this? D3 can be rendered to canvas, put handling interactions like mouse overs and clicks needs some customizations. Is this what is slowing down it being implemented in visx also?