Pie Chart
  • 02 Aug 2022
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

Pie Chart

  • Dark
    Light

Overview

A pie chart is a circular statistical graphic that shows the proportion of different data conveyed as slices within a cicle (i.e., pie). Pie charts are particularly useful when comparing a relatively small number of datasets — too many "slices" can make a pie chart difficult to read.

In this walkthrough, we will create a pie chart that displays the most common visualization types used in Superset.

Reference Content

The following articles may be useful resources as you build your chart:

  • Creating a Chart: A walkthrough of the overall process of chart selection and creation.
  • Using Preset Explore: How to work with the Explore page, the primary interface used when creating a chart.

Step 1: Create New Chart

To create a pie chart, in theToolbar, select + Chart.

The Create a new chart screen appears.

In the Choose a Dataset field, select a dataset to build your query from. In this case, we are selecting a dataset that includes information about Superset chart usage.

Select a Pie Chart in the chart gallery. Since it is included in the default recommended tag of #Popular, the pie chart option is already listed.

Next, select Create New Chart.

Create_Pie_Chart


Step 2: Configure the Chart

Time Panel

Reference: How to Configure the Time

The first step is to define the Time Column field. This field contains a time-related column from the dataset. More than likely, this field is pre-populated for you.

You can recognize time columns by looking in the Columns listing in the Metrics & Columns panel and finding those with a small clock icon.

In this example, we will drag & drop a different time column called created_dttm:

Pie_Chart_Drag_Time

Next, let's configure the Time Range field.

This field is used to specify a date & time range from which data will be extracted for the query. Generally-speaking, if you're working with a small dataset size, then it is best to use the No filter option (i.e., use all available data). If the dataset size is larger, though, then a date & time range is more appropriate.

In this case, we will filter from 01-01-2021 to Now. by using a Custom range type.

This is what the configuration looks like:

Define_Time_Range

Our completed Time panel looks as follows:

Completed_Time_Panel

Query Panel

For the configuration, we will Group By the visualization type (ABC viz_type), use the Charts metric, and set a Row Limit of 10,000.

The fields we used are:

  • Group By: One or more columns for grouping the data.
  • Metric: The metric or formula available in the dataset (see Metrics section in Metrics & Columns panel).
  • Row Limit: The maximum number of rows extracted from the dataset for the query.

Here is how it's done:

Pie_Chart_Configure_Query


Step 3: Run the Query

Reference: The Content Panel

Select Run or, in the Content panel, Run Query.

Run_Query

The pie chart appears in the Content panel.

Pie_Chart_Ran_Query

Most Preset charts are interactive, so feel free to hover your cursor over different elements of the visualization to get more data.

Additionally, you can expand the Data section to view data results and samples from the query.


Step 4: Finalizing the Chart

If you're happy with the visualization, be sure to give it a name:

Enter_Chart_Title_Here

If you'd like to customize your visualization, select the Customize tab.

Lastly, be sure to save your chart. Remember that you can also save your chart to a dashboard—or create a brand new dashboard—directly from the Save menu!

Final Chart

Final_Pie_Chart


Was this article helpful?

What's Next