All Products
Search
Document Center

DataWorks:Visualize data on a dashboard

Last Updated:Dec 05, 2024

DataWorks DataAnalysis provides a data visualization tool that you can use to visualize processed data in charts. This helps you quickly extract key information. This topic provides an example on how to use DataWorks to visualize user profile data.

Prerequisites

The required data is processed before you start the example. This means that the data that you want to use for a test is processed into basic user profile data by using DataWorks DataStudio.

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 top navigation bar, select the desired region. Then, choose DataAnalysis > SQL Query in the left-side navigation pane. 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. Manage permissions on a data source.

    To use a data source in DataAnalysis, you must have the required permissions on the data source. You can perform the following operations to grant your account the required permissions on the data source: Go to the Security Center page and choose Security policy > Data query and analysis control. On the page that appears, click the Queryable data source tab, find the data source that you want to query, and then click Authorization in the Actions column. For more information, see Use the data query and analysis control feature.

  2. Create a temporary file.

    1. Method 1: The first time you go to the SQL Query page or if no SQL query file is opened on the page, click Create SQL Query in the right-side area to create a temporary file.

    2. Method 2: If an existing SQL query file is opened, click the image.png icon to the right of the name of the existing file to create a temporary file.

    Note

    For more information about how to create an SQL query file, see Create an SQL query file.

  3. Select a data source for the SQL query file.

    On the configuration tab of the SQL query file, click the image.png icon in the upper-right corner to select a workspace, a compute engine type, and a data source for the SQL query file. In this example, a MaxCompute data source is selected.

Write SQL statements

On the configuration tab of the SQL query file, enter the following SQL statement and click the image.png icon to query data in the ads_user_info_1d table. In this example, data in the dt="20230222" partition is queried.

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

Query results and modify charts

  1. Query results.

    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.

    image.png

  2. Modify charts.

    Click the image.png icon in the upper-right corner of the chart to go to the configuration tab of the chart and modify the chart.

Numbers of registered members in different provinces and cities

  1. Double-click the original title of the chart and enter a title.

  2. Configure the style.

    On the right side of the configuration tab of the chart, click Style Settings. In the panel that appears, click the Change Chart tab and select Stacked Bar Chart.

  3. Configure data.

    On the left side of the configuration tab of the chart, click Data Settings. In the panel that appears, set the X-axis parameter to Count (Distinct Count) and the Y-axis parameter to region.

    1. Drag the uid field to the area where the X-axis parameter is located and choose Aggregate > Distinct Count from the X-axis drop-down list.

    2. Drag the region field to the area where the Y-axis parameter is located.

  4. Modify the titles of the x-axis and y-axis.

    On the right side of the configuration tab of the chart, click Style Settings. In the panel that appears, click the Global Settings tab. In the Chart Information section, click Details and then click the Chart Style tab.

    1. Click Axis Title in the X-axis section. Change the value of the Displayed Title parameter from uid to Number of Registered Members.

    2. Click Axis Title in the Y-axis section. Change the value of the Displayed Title parameter from region to Province.

    3. Click Save in the upper-right corner to save the chart.

  5. Confirm the final chart.

Distribution of page views of members in different age ranges

  1. Double-click the original title of the chart and enter a title.

  2. Configure the style.

    On the right side of the configuration tab of the chart, click Style Settings. In the panel that appears, click the Change Chart tab and select Pie Chart.

  3. Configure data.

    On the left side of the configuration tab of the chart, click Data Settings. In the panel that appears, set the Category parameter to age_range and the Value parameter to pv.

    1. Drag the age_range field to the area where the Category parameter is located.

    2. Drag the pv field to the area where the Value parameter is located and choose Aggregate > Sum from the Value drop-down list.

    3. Click Save in the upper-right corner to save the chart.

  4. Confirm the final chart.

Distribution of page views of members by gender

  1. Double-click the original title of the chart and enter a title.

  2. Configure the style.

    On the right side of the configuration tab of the chart, click Style Settings. In the panel that appears, click the Change Chart tab and select Pie Chart.

  3. Configure data.

    On the left side of the configuration tab of the chart, click Data Settings. In the panel that appears, set the Category parameter to gender and the Value parameter to pv.

    1. Drag the gender field to the area where the Category parameter is located.

    2. Drag the pv field to the area where the Value parameter is located and choose Aggregate > Sum from the Value drop-down list.

    3. Click Save in the upper-right corner to save the chart.

  4. Confirm the final chart.

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

  1. Double-click the original title of the chart and enter a title.

  2. Configure the style.

    On the right side of the configuration tab of the chart, click Style Settings. In the panel that appears, click the Change Chart tab and select Grouped Column Chart.

  3. Configure data.

    On the left side of the configuration tab of the chart, click Data Settings. In the panel that appears, configure the parameters.

    1. Drag the gender field to the area where the X-axis parameter is located.

    2. Drag the pv field to the area where the Y-axis parameter is located and choose Aggregate > Sum from the Y-axis drop-down list.

    3. Drag the zodiac field to the area where the Split parameter is located.

  4. Modify the titles of the x-axis and y-axis.

    On the right side of the configuration tab of the chart, click Style Settings. In the panel that appears, click the Global Settings tab. In the Chart Information section, click Details and then click the Chart Style tab.

    1. Click Axis Title in the X-axis section. Set the Displayed Title parameter to gender.

    2. Click Axis Title in the Y-axis section. Set the Displayed Title parameter to pv.

    3. Click Save in the upper-right corner to save the chart.

  5. Confirm the final chart.

What to do next

  1. After you modify the chart, you can click Save in the upper-right corner to permanently save the modification and then share the chart. If you want to visualize processed data by using other types of charts, click Save As.

  2. You can click Cards in the left-side navigation pane of the DataAnalysis page to view the charts on which you perform the save as operation.