FastUI
FastUI copied to clipboard
Chart component
Hi,
I think it would be great if we had a chart component (e.g. think 2D bar charts or scatter plots).
Guess the mechanism of supplying data in the backend could be similar as it is implemented for the Table
component.
For frontend implementation I think we could leverage something like Chart.js to do the charting work itself for us.
Not sure if this use case is common enough such that it would fit into FastUI itself or whether this should rather be considered a custom component and be separate from the package.
Any thoughts?
This would be a great feature. These libs are very feature complete:
https://plotly.com/graphing-libraries/ https://bokeh.org/
I think the simple solution is to return a vega JSON object perhaps from altair and render that in the frontend.
I think long term this is an idea that I'm really interested in, and I'd like to try to do something more powerful, particularly WRT interaction etc.
Also worth considering may be echarts, which has a json format and an (auto-gen) pydantic model in ezcharts.
From my limited perspective, there are 2 possible advantages:
- the chart types are more expansive with echarts, especially around tree based options which seem to be missing in vega-lite/altair.
- It looks like there is an event model that could somehow map nicely onto fastui.
ye, I agree echarts is probably the best way to go.
I've been using quarto recently which is great - with it you can build a website from pandoc-markdown.
they recently added a feature to support observablejs code blocks. this allows you to create interactive elements within an otherwise static website. could be of interest as an approach...
Hi guys, aftering reading the above comments, I still have no idea how to add a chart in the fastui. Can someone show me a piece of codes?
I made an initial proposal for this here: https://github.com/pydantic/FastUI/pull/201 using recharts
@tim-habitat Just noticed your PR is kind of stale, has there been any changes? This feature would be huge for FastUI
No nothing changed my side and would be happy to freshen up, though i suspect the team at pydantic might want to implement it in a different way based on the comments above.
This to me is why i would love to have a discussion about plugins / making it easier to extend components: https://github.com/pydantic/FastUI/issues/262
in that case i would be happy to implement a few graphs etc. and people could easily use that package, without it living in the core fastui
leaving space for the team to do as they see fit in the future.