rrag / react-stockcharts

Highly customizable stock charts with ReactJS and d3
http://rrag.github.io/react-stockcharts
MIT License
3.89k stars 958 forks source link

is svg support really necessary? #103

Closed rrag closed 8 years ago

rrag commented 8 years ago

I am thinking of removing svg support completely in a future version,

Benefits:

  1. smaller library size, because all code related to svg will be removed
  2. less testing time, possibly faster development of the library as no svg related code to write or test

Drawbacks:

  1. vector graphics mean ability to create resolution independent charts, so I could server render a chart with svg and create high resolution images
  2. no server side rendering to svg, server side rendering to canvas is possible with node-canvas though I have never tested it myself
  3. when developing new components I usually start with svg as it is easier to develop and troubleshoot, so development might become a little harder initially till we get used to developing with canvas first
  4. doing interactive components on canvas is much more difficult, and needs to be explored if it is even possible with the current design

The main motivation behind this thought is that, in order to improve the performance on pan actions, there are some hacks in place for canvas, and these hacks are getting bigger and complex to deal with to support both svg and canvas. I think most users don't really care if it is svg or canvas, they care about performance and usability.

Thoughts?

yinhm commented 8 years ago

+1 for performance and faster development

Svjard commented 8 years ago

Server-side can be a bummer however SVG performance is definitely not created equal among the browsers especially mobile, so I actually like the idea of Canvas only. For drawback 1, it is still easy enough to do off-screen canvas render for a given size and canvas save to image is trivial compared to passing svg to the server to get an image. Plus for my Ng2 port currently composing components inside the svg namespace is not possible because of Shadow DOM and workaround is not forthcoming anytime soon, so Canvas makes it much easier.

trevorbernard commented 8 years ago

Right now I use SVG because over canvas because it's doesn't render well on retina screens

WaiSiuKei commented 8 years ago

How about seperating into two repo, one using canvas, and one using SVG ( or react-native-svg for react-native support)

just attached my demos FYI https://github.com/WaiSiuKei/nila https://github.com/WaiSiuKei/react-native-nila

psunderr commented 8 years ago

Developing on 4k monitor, canvas render is not very sharp compared to SVG, as @trevorbernard also experienced with retina display.

rrag commented 8 years ago

Thank you all for your input, SVG output may be sharp on high res monitors, but the responsiveness will not match canvas. There were some anti aliasing issues with canvas earlier which I think I have rectified in the work in progress 0.6 version. @trevorbernard @psunderr Can you please check this on a 4k monitor, retina screen please. Is this any better?

psunderr commented 8 years ago

I'm not sure I see a difference on 4k, it seems to render the same (though the stroke around bars/candles may give a slight impression of increased crispness)

I will try to check on Retina shortly as well.

EDIT: The example you linked also looks fuzzy on iPhone 5 Retina display (1136-by-640-pixel resolution at 326 ppi)

rrag commented 8 years ago

RE: https://github.com/rrag/react-stockcharts/issues/119

@trevorbernard @psunderr can you test this?

http://rrag.github.io/react-stockcharts-next/documentation.html#/macd

rrag commented 8 years ago

I am going to keep svg support for now. it is so easy to debug with svg

itsjimbo commented 7 years ago

https://github.com/Flipboard/react-canvas Just thought I throw this out there.. I believe https://cryptowat.ch is built with react-canvas