Skip to content
  • 20after4's avatar
    Add custom_dashboard_chart plugin and dynamic filters · bf87331e
    20after4 authored
    * Proof of concept: Adds a new render_custom_dashboard_chart hook and a new 'custom' rendering engine type.
      The new hook can be used by other datasette plugins to render custom charts.
    * Also added a "select" type dashboard filter that populates it's list of options from a query
    supplied in the plugin config metadata.
    
    Example `render_custom_dashboard_chart` hook:
    
    ```python
    @hookimpl
    async def render_custom_dashboard_chart(chart_display):
        return "<h3>test <b>1</b> 2 3</h3>"
    ```
    
    Example query filter config:
    
    ```yaml
    plugins:
      datasette-dashboards:
        project-metrics:
          title: Data³ - workflow metrics
          description: Metrics about projects, tasks and workflows
          layout:
          - [ custom-chart-display, custom-chart-display]
          - [project-events, column-metrics]
          - [project-tasks-state, project-tasks-state]
          - [task-states,task-states ]
        filters:
            project:
              name: Project
              type: select
              query: select phid as key, name as label from Project
    ```
    bf87331e