All Products
Search
Document Center

DataWorks:Visualize data on a dashboard

Last Updated:Mar 25, 2026

DataWorks DataAnalysis includes a built-in SQL editor with data visualization. After querying a table, you can turn the results into interactive charts — bar, pie, or grouped column — to spot patterns, trends, and outliers without leaving the editor. This tutorial walks through four visualization scenarios using a sample user profile dataset.

Prerequisites

Before you begin, make sure that:

  • The required data is already processed. This tutorial uses the ads_user_info_1d_spark table, which contains basic user profile data processed by DataWorks DataStudio. See Process data.

  • Your account has permission to query the data source you plan to use. To grant permissions, go to Security Center > Security policy > Data query and analysis control > Queryable data source, find the data source, and click Authorization. For details, see Use the data query and analysis control feature.

Visualization scenarios

This tutorial covers the following four scenarios using the ads_user_info_1d_spark table.

ScenarioChart type
Numbers of registered members in different provinces and citiesStacked Bar Chart
Page view distribution by age rangePie Chart
Page view distribution by genderPie Chart
Page views by gender and zodiac signGrouped Column Chart

Open SQL Query

Log on to the DataWorks console. In the top navigation bar, select a region. In the left-side navigation pane, choose Data Analysis and Service > DataAnalysis, and then click Go to DataAnalysis. In the left-side navigation pane of DataAnalysis, click SQL Query.

Set up an SQL query file

  1. Create a temporary file.

    • If this is your first time on the SQL Query page or no file is open, click Create SQL Query.

    • If a file is already open, click the icon to the right of the existing file name to create a new temporary file.

    For more information about SQL query files, see SQL query.
  2. Select a data source. On the configuration tab of the SQL query file, click the icon in the upper-right corner to select a workspace, a compute engine type, and a data source. This tutorial uses a MaxCompute data source.

Query the data

On the configuration tab of the SQL query file, enter the following SQL statement and click the run icon to query the ads_user_info_1d_spark table.

-- If the desired partition is not found, run: show partitions tablename
select * from ads_user_info_1d_spark where dt='Data timestamp';

This tutorial queries the dt="20241126" partition.

Visualize query results

After the query completes, click the chart icon on the left side of the query results section to switch to the chart view. To open the chart configuration tab, click the icon in the upper-right corner of the chart.

image.png

Each scenario uses the following chart configuration areas:

AreaLocationPurpose
Style SettingsRight side of chart configuration tabChange chart type, customize axis titles
Data SettingsLeft side of chart configuration tabMap fields to X-axis, Y-axis, Category, Value, and Split

Each of the following sections configures one chart from the scenario table above.

Numbers of registered members in different provinces and cities

Chart configuration:

SettingValue
Chart typeStacked Bar Chart
X-axis fielduid — Aggregate: Distinct Count — Displayed Title: Number of Registered Members
Y-axis fieldregion — Displayed Title: Province

Steps:

  1. Double-click the chart title and enter a name.

  2. In Style Settings, click Change Chart and select Stacked Bar Chart.

  3. In Data Settings, drag uid to the X-axis area. From the X-axis drop-down list, choose Aggregate > Distinct Count. Drag region to the Y-axis area.

    image.png

  4. In Style Settings, click Global Settings > Chart Information > Details > Chart Style.

    • Under X-axis, click Axis Title and set Displayed Title to Number of Registered Members.

    • Under Y-axis, click Axis Title and set Displayed Title to Province.

  5. Click Save in the upper-right corner.

    image.png

Result:

image.png

Page view distribution by age range

Chart configuration:

SettingValue
Chart typePie Chart
Category fieldage_range
Value fieldpv — Aggregate: Sum

Steps:

  1. Double-click the chart title and enter a name.

  2. In Style Settings, click Change Chart and select Pie Chart.

  3. In Data Settings, drag age_range to the Category area. Drag pv to the Value area and choose Aggregate > Sum from the Value drop-down list.

  4. Click Save in the upper-right corner.

    image.png

Result:

image.png

Page view distribution by gender

Chart configuration:

SettingValue
Chart typePie Chart
Category fieldgender
Value fieldpv — Aggregate: Sum

Steps:

  1. Double-click the chart title and enter a name.

  2. In Style Settings, click Change Chart and select Pie Chart.

  3. In Data Settings, drag gender to the Category area. Drag pv to the Value area and choose Aggregate > Sum from the Value drop-down list.

  4. Click Save in the upper-right corner.

    image.png

Result:

image.png

Page views by gender and zodiac sign

Chart configuration:

SettingValue
Chart typeGrouped Column Chart
X-axis fieldgender — Displayed Title: gender
Y-axis fieldpv — Aggregate: Sum — Displayed Title: pv
Split fieldzodiac

Steps:

  1. Double-click the chart title and enter a name.

  2. In Style Settings, click Change Chart and select Grouped Column Chart.

  3. In Data Settings: image.png

    • Drag gender to the X-axis area.

    • Drag pv to the Y-axis area and choose Aggregate > Sum from the Y-axis drop-down list.

    • Drag zodiac to the Split area.

  4. In Style Settings, click Global Settings > Chart Information > Details > Chart Style.

    • Under X-axis, click Axis Title and set Displayed Title to gender.

    • Under Y-axis, click Axis Title and set Displayed Title to pv.

  5. Click Save in the upper-right corner.

    image.png

Result:

image.png

What's next

  • To save a chart permanently and share it, click Save in the upper-right corner.

    image.png

  • To create a copy of a chart under a new name (for example, to reuse the same query with a different chart type), click Save As.

  • To view all charts saved with Save As, click Cards in the left-side navigation pane of DataAnalysis.

    image.png