Programmatically control charts and scheduling



I’ve been using the Python datasource to programmatically curate query result.
I was wondering - can I also programmatically control/create charts? And control the refresh scheduling of multiple queries?
My scenario is that I have a large query that returns a table with several fields, something like:

date, value1, value2, bucket1, bucket2, bucket3

I eventually need a dashboard with multiple charts, in each chart I do “GROUP BY” a specific bucket, with the X value being the date and the Y value is value1 in one chart and value2 in another chart. So clearly I need multiple combinations of charts, and therefore would like to create them automatically (especially since in the future I would like to create more buckets.)