DataWorks DataAnalysis lets you run SQL queries against your data sources and turn the results into interactive charts. This tutorial walks through four visualization scenarios using processed user profile data stored in MaxCompute.
Prerequisites
Before you begin, make sure that you have:
Processed the required data using DataWorks DataStudio so that the
ads_user_info_1d_sparktable contains user profile dataAccess to the DataWorks console
Scenarios covered
Scenario | Chart type |
Numbers of registered members in different provinces and cities | Stacked Bar Chart |
Distribution of page views (PVs) of members in different age ranges | Pie Chart |
Distribution of PVs of members by gender | Pie Chart |
Numbers of PVs of members by gender and zodiac sign | Grouped Column Chart |
Step 1: Open the SQL Query page
Log on to the DataWorks console.
In the top navigation bar, select your region.
In the left-side navigation pane, choose Data Analysis and Service > DataAnalysis.
Click Go to DataAnalysis.
In the left-side navigation pane, click SQL Query.
Step 2: Configure a data source
Before running a query, grant your account access to the data source and create an SQL query file.
Grant access to the data source
Go to Security Center, choose Security policy > Data query and analysis control, and click the Queryable data source tab. Find the data source you want to query, then click Authorization in the Actions column. For details, see Use the data query and analysis control feature.
Create an SQL query file
Use either of the following methods to create a temporary file:
If no file is open: Click Create SQL Query in the right-side area.
If a file is already open: Click the
icon to the right of the existing file name.
For more information, see SQL query.
Select a data source
On the configuration tab of the SQL query file, click the
icon in the upper-right corner. Select a workspace, a compute engine type, and a data source. This tutorial uses a MaxCompute data source.
Step 3: Query the data
On the configuration tab of the SQL query file, enter the following SQL statement and click the
icon to run the query.
-- If the desired partition is not found, run the show partitions tablename command to view available partitions.
select * from ads_user_info_1d_spark where dt='Data timestamp';Replace 'Data timestamp' with an actual partition value (for example, '20241126') before running the query.
Step 4: Create and configure charts
After the query completes, click the
icon on the left side of the results area to switch to the chart view.
To open a chart's configuration tab, click the
icon in the upper-right corner of the chart.

All four scenarios follow the same configuration flow:
Double-click the chart title to enter a custom title.
Open Style Settings (right side of the configuration tab) and click Change Chart to select a chart type.
Open Data Settings (left side of the configuration tab) and drag fields to the appropriate parameter slots.
(Where needed) In Style Settings, go to Global Settings > Chart Information > Details > Chart Style to rename axis labels.
Click Save in the upper-right corner.
Supported aggregation options
When you drag a numeric field to an axis or value parameter slot, you can choose an aggregation function from the drop-down list:
Aggregation | Description |
Distinct Count | Counts the number of unique values |
Sum | Adds all values in the field |
The sections below describe the field mappings and chart type for each scenario.
Registered members by province and city
Chart type: Stacked Bar Chart
Data settings:
Axis | Field | Aggregation |
X-axis |
| Distinct Count |
Y-axis |
| — |
Axis labels:
Axis | Displayed title |
X-axis | Number of Registered Members |
Y-axis | Province |

Final chart:

Page views by age range
Chart type: Pie Chart
Data settings:
Parameter | Field | Aggregation |
Category |
| — |
Value |
| Sum |

Final chart:

Page views by gender
Chart type: Pie Chart
Data settings:
Parameter | Field | Aggregation |
Category |
| — |
Value |
| Sum |

Final chart:

Page views by gender and zodiac sign
Chart type: Grouped Column Chart
Data settings:
Parameter | Field | Aggregation |
X-axis |
| — |
Y-axis |
| Sum |
Split |
| — |
Axis labels:
Axis | Displayed title |
X-axis | gender |
Y-axis | pv |

Final chart:

What's next
Save and share: Click Save in the upper-right corner to permanently save a chart and share it.
Explore other chart types: Click Save As to create a copy of the current chart and reconfigure it with a different chart type.
View saved charts: In the left-side navigation pane of the DataAnalysis page, click Cards to see all charts saved with Save As.

