Open dantownsend opened 2 years ago
@dantownsend @Fidel-C I've been playing around a bit with adding charts to Picolo Admin. In addition to custom links
(#307), we can also have a separate Charts section. The result is this.
https://github.com/piccolo-orm/piccolo_admin/assets/30960668/1065f78d-8b7c-4139-a111-43317e862cac
The data format must be a list of lists
(eg. data=[["Male", 7], ["Female", 3]]
) to satisfy the frontend library (I used the Chartkick library). I used hardcoded data, but any function or coroutine which return list of lists, will satisfy the data format.
@sinisaos wow this is really nice
@sinisaos Yeah, that's really cool 👍
How large is the chartkick library? We just need to make sure we pick something which doesn't make the bundle size too large.
I'm already thinking how I could use this in my own projects ... I think it'll be very useful.
Thank you both for your kind words. @dantownsend Bundle size
@sinisaos is the chart feature now in the official version?
@Fidel-C No it's not. It's just an experiment. I didn't even make a PR because @dantownsend didn't say that the package size of the new Vue library is fine. You can patch a local installation from this branch so you can try it out. First you need to download, then cd
into admin_ui
directory and npm run build
. After that you can add piccolo_admin
to your virtualenv site packages (if you are using virtualenv).
Sorry, I haven't looked into it yet. Just need to try running the bundle locally, to see how big the compiled JS file is. From the look of the link you shared it doesn't seem too bad though.
@sinisaos thanks a lot for your help. But then, charts display has become a major requirement for modern admin panels. Maybe @dantownsend will consider that.
@dantownsend and @sinisaos Seems this feature has been replaced by the "links" feature? Cos I'm still looking forward to it.
@Fidel-C The chart PR is definitely still valid. I like the links feature because it's generally useful, but I've wanted native chart support for a while. I'm trying to get another PR finished off in the main Piccolo repo, then can turn my attention to these other PRs.
Alright cool. Will be waiting
I'm putting this here as a placeholder to collect thoughts. I don't think it's an immediate priority, but would be cool.
We support form creation using
FormConfig
. We might be able to add something similar calledChartConfig
. It would initially just be for very simple chart types, like bar, line, and pie.Here's an example:
There would be a new section in the sidebar: