Apache Superset provides powerful filtering options to enhance data visualization and user experience. This document explains how to use native filters and prefilters in dashboards, how to integrate filtered dashboards into web applications, and how to manage permissions to restrict users from editing charts.


Filter Options in Apache Superset

Apache Superset provides two primary methods to filter data in dashboards:

1. Prefilter

  • Prefiltering allows predefined filtering on the dashboard before the user interacts with it.
  • Useful for restricting data visibility based on user roles or predefined criteria.

2. Native Filter

  • Native filters provide an interactive filtering experience for users directly in the dashboard.
  • They allow dynamic data filtering based on selected criteria.

A sample Filter-ID and Token are provided below:

  • Filter ID: NATIVE_FILTER-xxxxxxxxxxxxxx1
  • Token: 43Tbxxxxxx890RT

Using these, you can filter data in a dashboard URL as follows:

https://localhost:5000/superset/dashboard/b669334e-7948-4fb5-80eb-6f4eac6d86bc/?permalink_key=pAzJAb0Mg3K&standalone=1&native_filters=(${filterId}:(__cache:(label:’${token}’,validateStatus:!f,value:!(‘${token}’)),extraFormData:(filters:!((col:token,op:IN,val:!(‘${token}’))),apply:!t),filterState:(label:’${token}’,validateStatus:!f,value:!(‘${token}’)),id:${filterId},ownState:()))&random=${Math.random()}

Embedding Apache Superset Dashboards in Web Applications

To integrate an Apache Superset dashboard into a web application, use an iframe as follows:

https://localhost:5000/superset/dashboard/b669334e-7948-4fb5-80eb-6f4eac6d86bc/?standalone=1

This will display the dashboard within your application. However, users may see an Edit Chart option when clicking the three dots on a chart. This allows direct access to Apache Superset without requiring login credentials.

To restrict this permission, follow the steps below:


Restricting the “Edit Chart” Permission

Step 1: Log into Apache Superset

Log in using your administrator credentials.

Step 2: Navigate to Role Management

  • Click on SettingsList Roles.
  • Locate the Public role (or the role assigned to embedded dashboard users).

Step 3: Modify Permissions

  • Click Edit on the Public role.
  • Look for the permission Can explore on Superset.
  • Remove this permission and save the role.

Step 4: Validate Changes

  • Open your embedded dashboard again.
  • The Edit Chart option should now be removed.

Leave a Reply