Visualize user profile data using DataWorks DataAnalysis
DataWorks DataAnalysis lets you run SQL queries and turn the results into interactive charts without leaving the console. This tutorial walks you through four visualization scenarios using a sample user profile dataset.
By the end, you will have configured four charts — a stacked bar chart, two pie charts, and a grouped column chart — ready to save and share with your team.
Visualization scenarios
| Scenario | Chart type | Why this chart type |
|---|---|---|
| Number of registered members by province and city | Stacked Bar Chart | Comparing counts across many categorical values (regions) |
| Page view distribution by age range | Pie Chart | Showing proportional breakdown of a single metric |
| Page view distribution by gender | Pie Chart | Showing proportional breakdown of a single metric |
| Page views by gender and zodiac sign | Grouped Column Chart | Comparing a metric across two dimensions simultaneously |
Prerequisites
Before you begin, ensure that you have:
Completed the data processing step — the sample dataset (
ads_user_info_1d_spark) must be available in MaxComputeAccess to the DataWorks console with permissions to use DataAnalysis
Open the SQL Query page
Log on to the DataWorks console.
In the top navigation bar, select the target 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.
Configure a data source
Grant data source permissions
To query a data source in DataAnalysis, your account must have the required permissions. To grant permissions:
Go to Security Center.
Choose Security policy > Data query and analysis control.
On the Queryable data source tab, find the target data source and click Authorization in the Actions column.
For details, see Use the data query and analysis control feature.
Create a temporary file
Create an SQL query file to run your query:
First time: Click Create SQL Query in the right-side area.
Existing file open: Click the
icon to the right of the file name to create a new temporary file.
Note: 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.
Query the data
On the configuration tab of the SQL query file, enter the following SQL statement and click the
icon to run it.
-- If the desired partition is not found, run the show partitions tablename command to check available partitions.
select * from ads_user_info_1d_spark where dt='Data timestamp';This query returns all columns from the ads_user_info_1d_spark table for the specified partition, including the fields used in the charts below: uid, region, age_range, pv, gender, and zodiac.
Build charts from query results
After the query completes, click the
icon on the left side of the result area to switch to chart view.

To configure a chart, click the
icon in the upper-right corner of the chart to open its configuration tab. Use Style Settings (right panel) to set the chart type and axis labels, and Data Settings (left panel) to map query fields to chart axes.
Number of registered members by province and city
A stacked bar chart works well here because it ranks and compares counts across many categorical values (provinces) at a glance.
Double-click the chart title and enter a descriptive name.
Set the chart type: in Style Settings > Change Chart, select Stacked Bar Chart.
Map the data fields 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.
Rename the axis labels: in Style Settings > Global Settings, click Details, then click the Chart Style tab.
In the X-axis section, click Axis Title and set Displayed Title to Number of Registered Members.
In the Y-axis section, click Axis Title and set Displayed Title to Province.
Click Save in the upper-right corner.


Page view distribution by age range
A pie chart is the natural choice here — it highlights proportional shares of a whole, making it easy to see which age group drives the most page views.
Double-click the chart title and enter a descriptive name.
Set the chart type: in Style Settings > Change Chart, select Pie Chart.
Map the data fields in Data Settings:
Drag age_range to the Category area.
Drag pv to the Value area. From the Value drop-down list, choose Aggregate > Sum.
Click Save in the upper-right corner.


Page view distribution by gender
This chart follows the same pattern as the age range chart — a pie chart shows proportional shares, this time split by gender instead of age group.
Double-click the chart title and enter a descriptive name.
Set the chart type: in Style Settings > Change Chart, select Pie Chart.
Map the data fields in Data Settings:
Drag gender to the Category area.
Drag pv to the Value area. From the Value drop-down list, choose Aggregate > Sum.
Click Save in the upper-right corner.


Page views by gender and zodiac sign
A grouped column chart lets you compare page views across two dimensions (gender and zodiac sign) in a single view — grouping columns by one dimension and splitting by the other makes both dimensions visible without switching between charts.
Double-click the chart title and enter a descriptive name.
Set the chart type: in Style Settings > Change Chart, select Grouped Column Chart.
Map the data fields in Data Settings:

Drag gender to the X-axis area.
Drag pv to the Y-axis area. From the Y-axis drop-down list, choose Aggregate > Sum.
Drag zodiac to the Split area.
Rename the axis labels: in Style Settings > Global Settings, click Details, then click the Chart Style tab.
In the X-axis section, click Axis Title and set Displayed Title to gender.
In the Y-axis section, click Axis Title and set Displayed Title to pv.
Click Save in the upper-right corner.


Save and share charts
After configuring a chart, you have two options:
Save: Click Save in the upper-right corner to permanently save the chart and share it with your team.
Save As: Click Save As if you want to visualize the data by using other types of charts.

To view all saved chart cards, click Cards in the left-side navigation pane of the DataAnalysis page.
