gravity-ui / yagr

Yet another graph renderer
https://yagr.tech
MIT License
96 stars 7 forks source link

Add Pie chart support #30

Open oleshiy opened 2 years ago

oleshiy commented 2 years ago

It will be very useful and gives ability to use your for more use cases.

zefirka commented 2 years ago

I see some difficulties:

  1. Fundamentals. The base of Yagr is uPlot, which certainly allows to use non-timeseries datasets (e.g. ordinal axes), but whole uPlot rendering system depends on axis-based plots, and it's the crucial issue with the pie chart. It's not possible to use uplot to render pie charts, which will bring the necessity to implement pie canvas-rendering into Yagr. And as I know uPlot don't considering to adding pie charts

  2. Typings. Whole type system should be refactored as of axis based plots are a basically the data matrix, but pie is a flat list of values (as all aggregated diagrams). This change will affect about every piece of code

  3. Motivation. The idea of Yagr is to provide fast and convenient library for timeseries charts rendering. It seems that it's very hard to overload SVG-based pie chart.

So, the resume: adding pie/donut (and other non axis-based diagrams) as a simple feature is impossible for current library code, it will require a massive refactoring and rethinking the whole approach and goals of Yagr. I can't decide it's on my own cuz it will require a lot of effort to put the Yagr on more generic rails and move away from the idea of being just a uPlot highlevel wrapper. If it will be done, it certainly will be a major update