Pre-requisites to Build Report/Chart
Data source - Data Sources can be physical tables from your database or virtual datasets defined within Superset. (We have defined Data source and cannot be altered)
Dataset - A dataset in Superset is essentially a table or a view in a database that Superset connects to. It provides a structured representation of your data, allowing you to perform various operations like filtering, sorting, and aggregating.
Datasets can be created from database tables or Views (called Datasets in Superset) that you want to expose in Superset for querying. There are pre-defined list of datasets available in the tenant once superset is enabled. Dataset can be created using the physical tables, you can also create virtual datasets with custom queries using SQL LAB. SQL LAB is not enabled by default and needs to be requested.
CLick on SQL LAB - write a query and click run. You can save the query for later use or save it as a dataset.Using Dataset to build Reports/Charts
Using Reports/Charts to build a Dashboard
Create ReportSelect the Appropriate Dataset
Explore Data Workflow: Utilize the Explore view to interact with your data. Here, you can:
View a list of columns and metrics in the Dataset view.
Preview data below the chart area.
Change visualization types, select columns, and group by metrics using the Data and Customize tabs.
Customization: Customize your bar chart's appearance by selecting options from drop-down menus. Click the Run button to refresh the visualization with your changes.
Temporal Column and Metrics: For a time-series bar chart, select the temporal column and the metric to group by. This allows you to visualize data over time, segmented by a specific metric.
Creation of Chart
To create a basic bar chart in Apache Superset, follow these steps:Select Dataset: Navigate to the Datasets tab and click on the dataset you want to use for your chart.
Choose Visualization: In the Explore view, select 'Bar Chart' as the visualization type.
Customize Chart: Use the Data and Customize tabs to select the metric for the Y-axis and the category for the X-axis.
Run Query: Click the Run button to generate the chart.
Save Chart: Once satisfied with the chart, click Save to add it to a dashboard.
Note: default row limit when requesting chart data
ROW_LIMIT = 50000Best Practices for Bar Chart Data Visualization
When creating bar charts with Apache Superset, consider the following best practices to enhance the clarity and effectiveness of your data visualization:
Choose the Right Data: Select categorical data that lends itself well to comparison.
Simplify Your Design: Avoid clutter by minimizing chart junk, such as excessive lines or colors.
Label Clearly: Ensure all axes, bars, and categories are clearly labeled for easy interpretation.
Use Consistent Scales: The scales on the axes should be consistent to avoid misleading viewers.
Color with Purpose: Use color to highlight important data points or group-related categories.
Sort Data Logically: Sort bars in a meaningful order, such as alphabetically or by value.
Example WorkflowConnect to Data Source:
Configure a new database connection in Superset.
Create a Dataset:
Use SQL Lab to write a query and save the results as a reusable dataset.
Build a Chart:
Create a new chart by selecting a dataset and choosing a chart type (e.g., bar chart).
Customize the chart with various options (e.g., axis labels, colors).
Design a Dashboard:
Create a new dashboard and add the previously created chart.
Arrange charts and add filters to enable interactive data exploration.
Share and Collaborate:
Share the dashboard with team members and stakeholders.
Collaborate on data exploration and visualization by commenting and making adjustments as needed.