GenderAvenger / tally

The Gender Avenger Tally web app
GNU Affero General Public License v3.0
2 stars 2 forks source link

Create chart rendering logic #122

Open slifty opened 2 years ago

slifty commented 2 years ago

This is the big one -- how do we want to render the chart in the rework.

One approach is to use a server side process like the current tally does; the benefit to this approach is that we generate an image asset from the input and that makes it easier to share. The downsides are:

  1. Requires a server
  2. It can be a heavier process / bottleneck
  3. We have to store the images
  4. Images are less accessible than svg / text

Part of implementing this issue is making this decision

slifty commented 2 years ago

If using a canvas approach for rendering at least, this SO question might help for saving: https://stackoverflow.com/questions/11112321/how-to-save-canvas-as-png-image

slifty commented 2 years ago

Alternatively, SVG could work for the chart portions -- https://medium.com/hackernoon/a-simple-pie-chart-in-svg-dbdd653b6936

This would mean that the chart becomes an HTML rendering, at which point we enter the world of "div-to-png conversion" -- https://stackoverflow.com/questions/18581379/how-to-save-the-contents-of-a-div-as-a-image

slifty commented 2 years ago

Another useful approach -- https://stackoverflow.com/questions/5433806/convert-embedded-svg-to-png-in-place

slifty commented 2 years ago

I'm moving forward with use of svg for this.

We want to support non-solid fills in the chart so this will come in handy: https://stackoverflow.com/questions/13069446/simple-fill-pattern-in-svg-diagonal-hatching