apache / apache/superset

[SIP-218] Proposal for Canvas-Based Custom Filter and Date Filter Chart Plugins

Open
#41,498 3 comments 0 reactions 0 assignees View on GitHub
design:proposal sip viz:charts
Dominant language
Python
Stars
74.8k
Forks
18.3k
Avg merge
2d 5h
Merged PRs (30d)
685

Description

## Motivation
To provide flexible dashboard layouts and deeper interactivity within Apache Superset, this SIP proposes the introduction of two unified, canvas-placed filter chart components. These components function as native chart plugins that leverage Superset’s existing **cross-filtering capabilities** to filter other charts on the dashboard.

### 1. Unified Custom Filter Chart (UI Controls)
By merging dropdowns, radio buttons, and checkboxes into a single, highly customizable chart plugin, dashboard creators can position filter controls anywhere on the dashboard grid. This entirely removes the layout constraints imposed by the traditional native filter bar.

#### Advanced Use Case: Tableau-Style Parameters via Jinja
For advanced analytics, this component seamlessly integrates with Superset’s Jinja templating engine to mimic Tableau-style parameter functionality. This allows users to dynamically swap columns, dimensions, or metrics on the fly.

**The Workflow:**
1. **Create a Parameter Dataset:** Build a lightweight, dedicated physical or virtual dataset containing the desired parameter values.
2. **Configure the Filter Chart:** Source the Custom Filter Chart from this dataset to display the values as a dropdown, radio button, or checkbox.
3. **Write Jinja-Powered Queries:** In the main analytical queries, use Superset's Jinja templating (e.g., `{{ filter_values('parameter_name') }}`) to capture the selected cross-filter value. Incorporate `CASE` statements or dynamic SQL injection to alter the query logic or swap dimensions/metrics based on the user's selection.

### 2. Custom Date Filter Chart
While Superset features a robust native filter bar, introducing a standalone, canvas-placed Date Filter chart solves two critical layout and scoping challenges:

* **Localized Scoping vs. User Confusion:** When a date filter is intended to target only a small subset of charts, placing it in the global native filter bar harms the user experience. Users naturally expect global bar filters to impact the entire dashboard. Placing a dedicated date component directly alongside the relevant charts on the canvas makes its localized scope instantly intuitive.
* **Multi-Date Field Filtering:** Managing independent date dimensions simultaneously is currently complex. For instance, if a dashboard requires a global date filter for `Order Date` affecting all charts, but simultaneously requires a secondary, localized date filter for `Shipping Date` affecting only a few specific charts, the native filter architecture falls short. This canvas-based plugin addresses that exact limitation.

---

## Proposed Change
This feature adds two new plugins to the existing visualization registry, acting similarly to Power BI's canvas Slicers.

The core implementation can be found in the following branch:
👉 [GitHub Repository: `custom_controls` Plugin Implementation](https://github.com/krmmkr/superset/tree/6.1-updates/superset-frontend/plugins/custom_controls)

### Visual Architecture & Interface

#### Chart Control Panel View
*(Controls for configuring dropdown, checkbox, or radio layouts)*
Chart Control Panel View

#### Filter Chart Deployed on Dashboard Canvas
*(Demonstrating flexible placement outside the native filter bar)*
Filter Chart in Dashboard

#### Custom Date Chart Deployed on Dashboard Canvas
*(Ant Design-based date selection dropdown emitting standard cross-filters)*
Custom Date Chart

---

## New or Changed Public Interfaces
This proposal introduces two new chart plugins to the Superset frontend visualization registry:

1. **Custom Filter Chart (`custom_controls`):** A single chart plugin containing dropdown, checkbox, and radio button components.
2. **Custom Date Filter Chart:** An Ant Design-based date selection dropdown that can be placed anywhere on the dashboard canvas to emit standard cross-filter events.

---

## Related Discussions & Dependencies
Because extensive use of canvas-placed filters naturally scales up the volume of active cross-filters on a single dashboard, this SIP is closely tied to the following discussions:

* **Core Discussion for this Proposal:** [Superset Discussion #40822](https://github.com/apache/superset/discussions/40822)
* **Proposed Cross-Filter Management UI Optimization:** To support the management of complex cross-filtering relationships generated by these plugins, see [Superset Discussion #40809](https://github.com/apache/superset/discussions/40809).

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the custom_controls plugin implementation in the linked 6.1-updates branch and the Superset visualization registry. Read Discussions #40822 and #40809 to understand the proposal and cross-filter management dependency. Done means both canvas-placed filter plugins support their described controls, date scoping, and standard cross-filter events.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
analytics, data-visualization, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.