Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(exploring-data): various updates to match latest superset version #17516

Merged
merged 4 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ select the **Edit** button.

<img src="/images/edit-record.png" />

In the resulting modal window, switch to the **Extra** tab and
tick the checkbox for **Allow Data Upload**. End by clicking the **Save** button.
In the resulting modal window, switch to the **Advanced** tab and
expand the **Security** section. Tick the checkbox for **Allow Data Upload**.
End by clicking the **Save** button.

<img src="/images/db-modal-advanced.png" />
<img src="/images/add-data-upload.png" />

### Loading CSV Data
Expand All @@ -59,18 +61,7 @@ Leaving all the other options in their default settings, select **Save** at the
You should now see _tutorial_flights_ as a dataset in the **Datasets** tab. Click on the entry to
launch an Explore workflow using this dataset.

In this section, we'll create a table visualization
to show the number of flights and cost per travel class.

By default, Apache Superset only shows the last week of data. In our example, we want to visualize all
of the data in the dataset. Click the **Time ‣ Time Range** section and change
the **Range Type** to **No Filter**.

<img src="/images/no_filter_on_time_filter.png" />

Click **Apply** to save.

Now, we want to specify the rows in our table by using the **Group by** option. Since in this
First, we want to specify the rows in our table by using the **Group by** option. Since in this
example, we want to understand different Travel Classes, we select **Travel Class** in this menu.

Next, we can specify the metrics we would like to see in our table with the **Metrics** option.
Expand All @@ -79,6 +70,7 @@ Next, we can specify the metrics we would like to see in our table with the **Me
(in this case, quantity of flights in each Travel Class)
- `SUM(Cost)`, which represents the total cost spent by each Travel Class

<img src="/images/count_column.png" />
<img src="/images/sum_cost_column.png" />

Finally, select **Run Query** to see the results of the table.
Expand Down Expand Up @@ -109,40 +101,42 @@ dashboard** and then hover over the table. By selecting the bottom right hand co

Finally, save your changes by selecting Save changes in the top right.

### Pivot Table
### Pivot Table v2

In this section, we will extend our analysis using a more complex visualization, Pivot Table. By the
In this section, we will extend our analysis using a more complex visualization, Pivot Table v2. By the
end of this section, you will have created a table that shows the monthly spend on flights for the
first six months, by department, by travel class.

Create a new chart by selecting **+ ‣ Chart** from the top right corner. Choose
tutorial_flights again as a datasource, then click on the visualization type to get to the
visualization menu. Select the **Pivot Table** visualization (you can filter by entering text in the
visualization menu. Select the **Pivot Table v2** visualization (you can filter by entering text in the
search box) and then **Create New Chart**.

<img src="/images/create_pivot.png" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove create_pivot.png and all the other old pictures?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

<img src="/images/create_pivot_2.png" />

In the **Time** section, keep the Time Column as Travel Date (this is selected automatically as we
In the **Time** section, keep the Time Column as Travel Date (this is selected automatically, as we
only have one time column in our dataset). Then select Time Grain to be month as having daily data
would be too granular to see patterns from. Then select the time range to be the first six months of
2011 by click on Last week in the Time Range section, then in Custom selecting a Start / end of 1st
January 2011 and 30th June 2011 respectively by either entering directly the dates or using the
calendar widget (by selecting the month name and then the year, you can move more quickly to far
away dates).
would be too granular to see patterns from. Then select the Time Range to be the first six months of
2011 by clicking into the Time Range edit menu, selecting Custom from the Range Type dropdown,
and selecting a Start / end of 1st January 2011 and 30th June 2011 respectively by either entering
the dates directly or using the calendar widget (by selecting the month name and then the year, you
can move more quickly to far away dates).

<img src="/images/select_dates_pivot_table.png" />
<img src="/images/select_dates_pivot_table_v2.png" />

Next, within the **Query** section, remove the default COUNT(\*) and add Cost, keeping the default
SUM aggregate. Note that Apache Superset will indicate the type of the metric by the symbol on the
left hand column of the list (ABC for string, # for number, a clock face for time, etc.).
Next, within the **Query** section, add a SUM(Cost) metric. Note that Apache Superset will indicate
the type of the metric by the symbol on the left hand column of the list (ABC for string, # for
number, a clock face for time, etc.).

In **Group by** select **Time**: this will automatically use the Time Column and Time Grain
In **Rows** select **Travel Date**: this will automatically use the Time Column and Time Grain
selections we defined in the Time section.

Within **Columns**, select first Department and then Travel Class. All set – let’s **Run Query** to
see some data!
Within **Columns**, select first Department and then Travel Class.

Under **Options**, tick the Show Rows Total and Show Columns Total checkboxes. All set – let’s
**Run Query** to see some data!

<img src="/images/tutorial_pivot_table.png" />
<img src="/images/tutorial_pivot_table_v2.png" />

You should see months in the rows and Department and Travel Class in the columns. Publish this chart
to your existing Tutorial Dashboard you created earlier.
Expand Down Expand Up @@ -180,7 +174,7 @@ Once you’re done, publish the chart in your Tutorial Dashboard.

### Markup

In this section, we will add some text to our dashboard. If you’re there already, you can navigate
In this section, we will add some text to our dashboard. If you’re not there already, you can navigate
to the dashboard by selecting Dashboards on the top menu, then Tutorial dashboard from the list of
dashboards. Got into edit mode by selecting **Edit dashboard**.

Expand Down Expand Up @@ -245,12 +239,12 @@ annotation to the Tutorial Line Chart we made in a previous section. Specificall
dates when some flights were cancelled by the UK’s Civil Aviation Authority in response to the
eruption of the Grímsvötn volcano in Iceland (23-25 May 2011).

First, add an annotation layer by navigating to Manage ‣ Annotation Layers. Add a new annotation
layer by selecting the green plus sign to add a new record. Enter the name Volcanic Eruptions and
First, add an annotation layer by navigating to Settings ‣ Manage ‣ Annotation Layers. Add a new annotation
layer by selecting the blue plus button to add a new record. Enter the name Volcanic Eruptions and
save. We can use this layer to refer to a number of different annotations.

Next, add an annotation by navigating to Manage ‣ Annotations and then create a new annotation by
selecting the green plus sign. Then, select the Volcanic Eruptions layer, add a short description
Next, add an annotation by clicking into the newly created layer and then create a new annotation by
selecting the blue plus button. Then, select the Volcanic Eruptions layer, add a short description
Grímsvötn and the eruption dates (23-25 May 2011) before finally saving.

<img src="/images/edit_annotation.png" />
Expand All @@ -260,7 +254,7 @@ list. Next, go to the Annotations and Layers section and select Add Annotation L
dialogue:

- Name the layer as Volcanic Eruptions
- Change the Annotation Layer Type to Event
- Change the Annotation Layer Type to Interval
- Set the Annotation Source as Superset annotation
- Specify the Annotation Layer as Volcanic Eruptions

Expand Down Expand Up @@ -299,7 +293,7 @@ Dashboard.

There is quite a lot of variation in the data, which makes it difficult to identify any trend. One
approach we can take is to show instead a rolling average of the time series. To do this, in the
**Moving Average** subsection of **Advanced Analytics**, select mean in the **Rolling** box and
**Rolling Window** subsection of **Advanced Analytics**, select mean in the **Rolling Function** box and
enter 7 into both Periods and Min Periods. The period is the length of the rolling period expressed
as a multiple of the Time Grain. In our example, the Time Grain is day, so the rolling period is 7
days, such that on the 7th October 2011 the value shown would correspond to the first seven days of
Expand Down
Binary file modified docs/static/images/add-data-upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/images/count_column.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/static/images/create_pivot.png
Binary file not shown.
Binary file added docs/static/images/create_pivot_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/images/db-modal-advanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/static/images/no_filter_on_time_filter.png
Binary file not shown.
Binary file removed docs/static/images/select_dates_pivot_table.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/static/images/sum_cost_column.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/static/images/tutorial_pivot_table.png
Binary file not shown.
Binary file added docs/static/images/tutorial_pivot_table_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.