All Products
Search
Document Center

DataWorks:Visualize data on a dashboard

Last Updated:Oct 20, 2023

This topic describes how to use DataWorks DataAnalysis to visualize user profile data.

Prerequisites

The data that you want to use for a test is processed into basic user profile data by using DataWorks DataStudio. For more information, see Process data.

Go to the SQL Query page

In this example, the SQL query feature of DataAnalysis is used to show how data is visualized.

Log on to the DataWorks console. In the left-side navigation pane, choose DataAnalysis > SQL Query. On the page that appears, select the desired workspace from the drop-down list and click Go to SQL Query.

Configure a data source for an SQL query

  1. On the SQL Query page, click Create SQL Query. The temporary file configuration tab for the SQL query appears.

  2. In the upper-right corner of the tab, specify the workspace, and compute engine type or data source for the SQL query, as shown in the following figure. If the data source that you want to use is not displayed in the Data Source drop-down list, you can contact the administrator to grant the required permissions on the data source in Security Center.

    image.png
  3. In the left-side navigation pane of the Security policy > Security Center > Queryable data source tab, find the odps_first data source, and then grant the permissions on the data source to the account that you use.

    image.png
  4. Go back to the temporary file configuration tab for the SQL query and select the odps_first data source from the Data Source drop-down list.

Write SQL statements

On the temporary file configuration tab, enter the following SQL statement and click the image.png icon to query data in the ads_user_info_1d table:

select * from ads_user_info_1d where dt='Data timestamp';// If the desired partition is not found, you can run the show partitions tablename command to view and confirm the table partition.

image.png

Visualize the query result

You can click the image.png icon on the left side of the section where the query result is displayed to visualize the query result. The following figure provides a data analysis example.

Set dt to yyyy-MM-dd before you perform other operations.

image.png

Numbers of registered members in different provinces and cities

  1. Select a chart type and data.

    In this example, the stacked bar chart type is selected. The Y-axis field is set to region and the X-axis field is set to Count (uid).

    image.png
  2. Specify an aggregation method.

    Change the value of Aggregation Method from Count to Distinct Count, as shown in the following figure.

    image.png
  3. Confirm the final chart.

    image.png

Distribution of page views of members in different age ranges

  1. Select a chart type and data.

    The pie chart type is selected. The Slice field is set to age_range and the X-axis field is set to Sum (pv).

    image.png
  2. Specify an aggregation method.

    Set Aggregation Method to Sum, as shown in the following figure.

    image.png
  3. Confirm the final chart.

    image.png

Distribution of page views of members by gender

  1. Select a chart type and data.

    The pie chart type is selected. The Slice field is set to gender and the Value field is set to Sum (pv).

    image.png
  2. Specify an aggregation method.

  3. Set Aggregation Method to Sum, as shown in the following figure.

    image.png
  4. Confirm the final chart.

    image.png

Numbers of page views of members counted by gender and zodiac sign

  1. Select a chart type and data.

    The grouped column chart type is selected. The X-axis field is set to gender, the Y-axis field is set to Sum (pv), and the Split field is set to zodiac.

    image.png
  2. Specify an aggregation method.

    Set Aggregation Method to Sum, as shown in the following figure.

    image.png
  3. Confirm the final chart.

    image.png