Visual analysis

Updated at:

IoT Data Analytics provides a Visual Analysis feature that lets you analyze product data (thing tags) or data tables and display the results in a table. You can use table editing functions such as rename, filter, aggregate, and sort to further analyze the data. You can then package the analysis results into a data API for developers to call.

Prerequisites

To perform a visual analysis on product and device data, you must first complete the following steps:
  1. create a product
  2. create a device individually
  3. add a thing model individually

Create a visual analysis

  1. Log on to the IoT Data Analytics console, choose Analysis and Perspective from the top navigation bar, and then click the Visual Analysis tab.
  2. Click New Visual Analysis. In the dialog box that appears, configure the parameters.
    For Data Source Type, you can select one of the following options:
    • thing tag: Data such as properties and events reported by IoT devices. For more information, see How to use thing tags.
    • data table: Data tables from manually added device data sources or external data sources. For more information, see How to use data tables.

    The following is an example of selecting Thing Tag.

    Visual Analysis nameVisual analysis descriptionIn the dialog box, enter a (required) and a (up to 100 characters), and then select a data source type.
  3. Click OK to open the Visual Analysis Workbench.
    Note

    The images in this topic show the default (light) theme. IoT Data Analytics allows you to customize the workbench theme. To do this, click the settings icon 设置 in the upper-right corner of the workbench and select Dark Theme.

    The Visual Analysis Workbench is divided into the Thing Tag List area on the left and the data display area on the right. The Data Source area in the upper-left corner contains the Select Product button. The top toolbar includes buttons to rename, filter, aggregate, and sort data. The upper-right corner contains SQL Preview and History.
  4. Click Select Product, choose the product that you want to analyze, and then click OK.
    Note The product drop-down list shows up to 50 recent products. You can also search for a product by name.
    After you select a product, the Visual Analysis Workbench displays the thing tags for that product.
    Note basic tag (snapshot), composite tag, and basic tag (time series) are system-generated thing tags.
    In addition to the system tags, the thing tag list displays the device property tag (time series) and device property tag (snapshot) categories, which include specific property tags such as temperature, relative humidity, and wind direction.
  5. In the tag selection area on the left, select one or more thing tags to analyze.
    After you select the tags, the Visual Analysis Workbench displays the corresponding tag data in a table.
    Note
    • You cannot select both a device property tag (time series) and a device property tag (snapshot) for the same analysis.
    • The more tags you select, the longer the query takes. The analysis task is terminated if it does not complete within one minute.

    The following table describes each area of the workbench.

    Area Description
    ① Displays the data table for the selected thing tags.

    The table displays a maximum of 200 records. To retrieve more records, use the CSV Download feature in SQL Analysis.

    ② Displays the modifiable time range for the table data.
    ③ Displays the buttons for editing the table.
    • 重命名: Renames a specified column.
      • Supported characters include Chinese characters, English letters, numbers, underscores (_), hyphens (-), and English parentheses (()). The column name can be up to 30 characters long.
      • Column names in a table must be unique.
    • 筛选: Enter filter conditions to select specific data.

      For example, where t0_PM25 > ${quest} filters for all values in the t0_PM25 column that are greater than the value of the request parameter (quest, which you can customize).

      After you enter the filter condition, click Configure Parameters. In the dialog box, set the parameter type and a default value, for example, INTEGER and 200. Then, click Apply. The visual analysis table then displays all data where the PM value is greater than 200.

      Note
      • Filter conditions must start with where.
      • When you add a dynamic request parameter, you must enclose the parameter name in ${}, for example, ${quest}. You must configure a default value for the request parameter to display the corresponding data in the table.

        When you package the analysis task as a data API, the dynamic request parameters that you add here become the request parameters for the API.

      • You cannot add duplicate dynamic parameter names.

      For more filter expressions, see MySQL WHERE.

    • 数据聚合: Calculates data for a specified column based on aggregation dimensions and an expression.
      • Select aggregate columns: Specifies the aggregation dimensions. You can select multiple columns.
      • Value: Enter an aggregation expression. Place the name of the column to be aggregated inside the function's parentheses. The calculation applies to this column across the specified dimensions. The following functions are supported:
        • sum(column name): Calculates the sum.
        • max(column name): Finds the maximum value.
        • min(column name): Finds the minimum value.
        • avg(column name): Calculates the average value.
      • Column Name: Defines a custom name for the column that contains the aggregation results. The aggregated table displays only the dimension columns and the result column.
        Note When you package the analysis task as a data API, this column name and its corresponding value become a response parameter and its data for the API.
    • 排序: Sorts the data in a specified column in ascending or descending order.
    ④ View the SQL statements or operation history from area ③.
    Note
    • In the history, you can edit and delete records. However, rename operations cannot be modified or applied.
    • If you reselect or clear thing tags, the history for filter, rename, aggregate, and sort operations is cleared.
    ⑤ Saves the current operation results.
    ⑥ Generates a data API. For instructions, see "Generate a data API" below.

Generate a data API

A data API is a type of Data Service. You can call the data API by using an SDK and embed its data into other applications. For more information, see How to use a Data Service.

  1. Follow the steps in the Create a visual analysis section, and complete the filter example operation described under ③ in step 5.
  2. In the upper-right corner of the page, click the Configure button.
    ConfigurationThe button is on the toolbar, next to the save time display.
  3. On the right-side panel, configure the parameters and click Apply.
    Clicking the Configure button opens the Generate API panel. The Basic Information area at the top contains the API name and ApiSrn fields. Below this are the configuration areas for request parameters, response parameters, and advanced settings.
    Parameter Description
    Request parameters These are the parameters that you defined during the filter operation in area ③ of step 5.

    You can customize the settings.

    Response parameters You can view all response parameters in SQL Preview in the upper-right corner of the Visual Analysis Workbench.

    You can customize the settings.

    advanced settings This section contains the following settings:
    • Select the Enable result pagination checkbox to display large amounts of data across multiple pages.
    • If you clear the Enable result pagination checkbox, a maximum of 2,000 records are returned by default.
  4. In the upper-right corner of the Visual Analysis Workbench, click the Test API button 测试. On the Test Data Service page, enter values for the request parameters and click Start Test.
    Test Data ServiceRequest detailsResponse contentThe page displays the basic information and request parameter configuration on the left, and the (request log) and (query results in JSON format) on the right. When the test is complete, the result status appears at the bottom of the page.
  5. In the lower-right corner, click Close to return to the Visual Analysis Workbench page.
  6. In the upper-right corner of the page, click the Publish button 发布, and then click OK.
    Click the View button 查看 to view detailed API information on the Data Service Details page.

    You can also click unpublish to edit the visual analysis table again.

    On the Visual Analysis tab, the status of the visual analysis changes to published.

    Click the 编辑 button in the upper-right corner to clone, modify information, or delete the analysis.

Related topics

Visual Analysis applications