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 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
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 Use the data query and analysis control feature.
. 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, seeCreate a temporary file.
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.
Method 2: If an existing SQL query file is opened, click the icon to the right of the name of the existing file to create a temporary file.
NoteFor more information about how to create an SQL query file, see Create an SQL query file.
Select a data source for the SQL query file.
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 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 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
Query results.
You can click the icon on the left side of the section where the query result is displayed to visualize the query result.
Modify charts.
Click the 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
Double-click the original title of the chart and enter a title.
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.
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.
Drag the uid field to the area where the X-axis parameter is located and choose
from the X-axis drop-down list.Drag the region field to the area where the Y-axis parameter is located.
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.
Click Axis Title in the X-axis section. Change the value of the Displayed Title parameter from uid to Number of Registered Members.
Click Axis Title in the Y-axis section. Change the value of the Displayed Title parameter from region to Province.
Click Save in the upper-right corner to save the chart.
Confirm the final chart.
Distribution of page views of members in different age ranges
Double-click the original title of the chart and enter a title.
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.
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.
Drag the age_range field to the area where the Category parameter is located.
Drag the pv field to the area where the Value parameter is located and choose
from the Value drop-down list.Click Save in the upper-right corner to save the chart.
Confirm the final chart.
Distribution of page views of members by gender
Double-click the original title of the chart and enter a title.
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.
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.
Drag the gender field to the area where the Category parameter is located.
Drag the pv field to the area where the Value parameter is located and choose
from the Value drop-down list.Click Save in the upper-right corner to save the chart.
Confirm the final chart.
Numbers of page views of members counted by gender and zodiac sign
Double-click the original title of the chart and enter a title.
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.
Configure data.
On the left side of the configuration tab of the chart, click Data Settings. In the panel that appears, configure the parameters.
Drag the gender field to the area where the X-axis parameter is located.
Drag the pv field to the area where the Y-axis parameter is located and choose
from the Y-axis drop-down list.Drag the zodiac field to the area where the Split parameter is located.
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.
Click Axis Title in the X-axis section. Set the Displayed Title parameter to gender.
Click Axis Title in the Y-axis section. Set the Displayed Title parameter to pv.
Click Save in the upper-right corner to save the chart.
Confirm the final chart.
What to do next
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.
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.