Data visualization

Updated at:

The DataAnalysis module in DataWorks provides a data visualization tool to display processed data in charts, allowing for quick analysis. This topic demonstrates how to visualize user profile data.

Prerequisites

Before you begin, ensure you have completed the steps in Process data to generate the basic user profile data.

Visualization scenarios

This example uses DataAnalysis to visualize and analyze user profile data, covering the following scenarios:

Scenario

Chart example

City registration leaderboard

image.png

Visit count distribution by age for registered members

image.png

Visit count distribution by gender for registered members

image.png

Analysis of visit counts by gender and zodiac sign

image.png

Go to the SQL Query page

The operations in this example are performed in the DataAnalysis's SQL Query feature.

Log on to the DataWorks console. In the target region, click Data Analysis and Service > DataAnalysis in the left-side navigation pane. Click Go to DataAnalysis to open the Data Analysis page. In the left-side navigation pane, click SQL Query.

Configure SQL Query data source

  1. Authorize the Data Source.

    To use a data source in DataAnalysis, you must first authorize it. Go to Security Center > Security policy > Data query and analysis control > Queryable data source. Find the data source that you want to query, click Authorization in the Operation column, and grant permissions to your account. For more information, see Security Center.

  2. Create a Temporary File.

    1. Method 1: If this is your first time on the SQL Query page or no SQL file is open in the current window, click Create SQL Query to create a Temporary File.

    2. Method 2: If an SQL file is already open, click the image.png icon to create a Temporary File.

    Note

    For more information about creating an SQL query, see SQL Query (Legacy).

  3. Select a Data Source.

    On the temporary file edit page, click the image.png icon in the upper-right corner. Select the workspace, engine type, and data source for your query. This example uses a MaxCompute data source.

Write an SQL query

In the temporary file editor, enter the following SQL statement and click the image.png button to query data in the ads_user_info_1d_emr table. In this example, the partition is dt='<your_date>'.

-- If the target partition is not found, you can run `show partitions <table_name>` to confirm the available partitions.
select * from ads_user_info_1d_emr where dt='<your_date>';

View query results and modify charts

After the query returns results, click the image.png icon in the left-side panel to create a visualization. You can also click the image.png icon in the upper-right corner of the chart to open the chart editor and modify the chart.

image.png

User ranking by city

  1. Double-click the default chart title and enter a new title.

  2. Configure the style.

    In the right-side panel, go to Stacked Bar Chart.

  3. Configure the data.

    In the left-side panel, click Data Settings. Configure the X Axis to show a Distinct count and the Y Axis to show the Region.

    1. Drag the UID field to the X Axiswell. From the X Axis drop-down list, select Aggregate > Distinct Count.

    2. Drag the Region field to the Y Axis well.

    image.png

  4. Modify the axis titles.

    In the right-side panel, click Style Settings. Under Global Settings, click Details and select the Chart Style tab.

    1. Click the axis title of the X Axis. In the Title Display section, change the X Axis field from UID to Number of Registered Members.

    2. Click the axis title on the Y Axis, and in the Title Display section, change the Y Axis field from Region to Province.

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

    image.png

  5. Review the final chart.

    image.png

Age distribution

  1. Double-click the default chart title and enter a new title.

  2. Configure the style.

    In the right-side panel, go to Pie chart.

  3. Configure the data.

    In the left-side panel, click Data Settings. Set the category field to age_range and the value field to pv.

    1. Drag the age_range field to the Category well.

    2. Drag the pv field to the Value well. From the Value drop-down list, select Aggregate > Sum.

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

    image.png

  4. Review the final chart.

    image.png

Gender distribution

  1. Double-click the default chart title and enter a new title.

  2. Configure the style.

    In the right-side panel, go to Pie chart.

  3. Configure the data.

    In the left-side panel, click Data Settings. Set the category field to gender, and the Value field to pv.

    1. Drag the gender field to the Category well.

    2. Drag the pv field to the Value well. From the Value drop-down list, select Aggregate > Sum.

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

    image.png

  4. Review the final chart.

    image.png

Gender and zodiac analysis

  1. Double-click the default title and enter a new title.

  2. Configure the style.

    In the right-side panel, go to Grouped Column Chart.

  3. Configure the data.

    In the left-side panel, click Data Settings and configure the fields:

    1. Drag the gender field to the X Axis well.

    2. Drag the pv field to the Y Axis well. From the Y Axis drop-down list, select Aggregate > Sum.

    3. Drag the zodiac field to the Split well.

    image.png

  4. Modify the axis titles.

    In the right-side panel, click Style Settings. Under Global Settings, click Details and select the Chart Style tab.

    1. Click the axis title on the X Axis, and in the Title Display section, you can set the field information for the X Axis by changing gender to Gender.

    2. Click the axis title on the Y Axis. In the Title Display section, you can set the field information for the Y Axis by changing pv to Number of visits.

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

    image.png

  5. Review the final chart.

    image.png

Next steps

  1. After editing a chart, click the Save button in the upper-right corner to save and share it. To create another visualization of the same data with a different style, click the Save As button.

    image.png

  2. To view your saved charts, go to the DataAnalysis page and click the image icon in the sidebar.

    image.png