All Products
Search
Document Center

Manage charts

Last Updated: Jul 29, 2020

A chart is the smallest unit for data visualization. A chart is generated by aggregating and grouping SQL query results based on the dataset model provided by a dataset, and then visualizing the processed data by using code.
Each chart must be associated with a dataset. In the chart editor, the original SQL statement and the data model in a dataset are used to generate a new SQL statement. Then, the new SQL statement is executed to query data that is to be visually presented in a chart. This topic describes features of charts and how to use charts.

How it works

1

Features

Chart editor

Data Visualization-chart1

The following table describes the three sections of the chart editor.

No. Section Description
Dataset model display section After you select a dataset in the upper-left corner of this section, its dataset model will be automatically displayed below, including dimensions and measures.
You can drag and drop fields in this section to corresponding areas on the Data tab in the chart configuration section.
Chart configuration section On the top of this section, you can select a configuration mode and a chart type. Move the pointer over a chart type icon to see how many dimensions and measures are required for this chart type. Below the chart type icons are three tabs.
  • On the Data tab, you can specify which fields in the dataset model are needed for the chart. You can simply drag and drop fields from the dataset model display section to corresponding areas on this tab.
  • On the Style tab, you can set the display style of the chart.
  • On the Settings tab, you can configure functional modules for the chart, such as filters and cache.
Chart display section This section displays the chart based on the dataset model and your configurations in the chart configuration section.

Configuration modes

The chart configuration section provides you with two configuration modes, including the pivot-driven mode and chart-driven mode, that are based on different visual presentation logic. This meets different requirements in various scenarios.

Configuration mode Description Scenario
Chart-driven mode The chart-driven mode represents the general visual presentation logic that is based on chart classification. Various charts can be configured by using the chart-driven mode. In this mode, dimensions and measures can be regarded as fixed configuration items, along with style settings, for configuring a chart. The chart-driven mode is applicable to most data visualization scenarios.
Pivot-driven mode The pivot-driven mode represents the visual presentation logic that is based on pivot tables. A chart configured by using the pivot-driven mode can be regarded as the visualization of a pivot table through coding. Specifically, dimensions and measures in the pivot table are converted to axes in the chart, for graphic display. In this mode, you can configure different graphic coding for each measure. The lowest-level dimension can be used as a common dimension axis. The pivot-driven mode is applicable to scenarios where data needs to be freely analyzed on clients.

Data configuration

To complete data configuration, you need to drag and drop fields from the dataset model display section to corresponding areas on the Data tab in the chart configuration section. When you are dragging a field, the area where the field can be put is highlighted on the Data tab.
3

  • Dimension configuration
    Only categorical fields can be put in the Dimension area. Values of each field in this area will be grouped in the new SQL statement to be generated.

  • Measure configuration

    • Only fields of the NUMERIC type can be put in the Measure area. Values of each field in this area will be aggregated in the new SQL statement to be generated. To specify how a field will be aggregated, you can click the field name and select an aggregate function. Currently, you can use the following six aggregate functions:
      • sum
      • avg
      • count
      • count_distinct
      • max
      • min
    • You can specify the following data formats for fields in the Measure area:
      • The default format.
      • Number: You can specify a unit, the number of decimal places that numbers are rounded to, and whether to use thousands separators.
      • Currency: You can specify a unit, the number of decimal places that numbers are rounded to, whether to use thousands separators. You can also prefix and suffix texts.
      • Percentage: You can specify the number of decimal places that numbers are rounded to.
      • Scientific notation: You can specify the number of decimal places that numbers are rounded to.
  • Filter configuration
    Both dimension and measure fields can be put in the Filter area. Values of fields in this area will be used to specify filter conditions in the SQL statement to be generated. Data can be filtered by values, conditions, and dates.

    Filter methods applicable to each field in this area correspond to the visualization type that you specified for the field when configuring the dataset model.

    Filter method Description Visualization type
    By conditions Filtering by conditions is the most flexible filter method. In the filter configuration dialog box, you can specify filter conditions for the selected field as you want. You can also use the logical AND and logical OR operators to specify multiple conditions.
    • Numeric
    • String
    • Region
    By values In the filter configuration dialog box, a set of distinct values of the selected field are listed in the left-side section. You can select values from this section and add them to the right section to filter data.
    • String
    • Region
    By dates You can query the selected field in a specified period of time, whether the period of time is fixed on the timeline or moves on the timeline.
    • Date

    4

    5

    6

  • Color settings
    Currently, you can only put one dimension field in the Grouping area. Values of the field in this area will be grouped in the new SQL statement to be generated. In the chart to be generated, values of the field will be grouped. Each group has a distinct color. The legend of the chart will help you differentiate groups with different colors.
    If you want measures of a dimension to be displayed as several groups in a chart, you can use color settings to differentiate the groups.

    For example, a dataset model contains the trade_date, zone, and price fields, respectively representing the transaction date, transaction region, and transaction volume. You want a bar chart to show aggregated transaction volumes of each region by day. In this case, you can put the trade_date field in the Dimension area, the zone field in the Grouping area, and the price field in the Measure area.
    7

    Note: When you generate a pie chart, you need to specify a dimension field whose values are to be grouped. In this case, you need to put the dimension field in the Grouping area instead of the Dimension area.

  • General settings for fields

    • Field alias: Click a field name and select Field settings. In the dialog box that appears, specify a field alias in the RETURN clause in the Field alias section. Currently, you can specify the following two types of field aliases:

      • Permanent alias.
      • Dynamic alias: Dynamic aliases are generated by writing code in JavaScript and can be used with variables. DMS provides the Moment.js library that can be used with variables to dynamically generate aliases for fields of the DATE type. Currently, dynamic aliases can only be generated for fields in table charts.
        8
        9
    • Field description:
      Click a field name and select Field settings. In the dialog box that appears, enter a description in the Description section. Currently, you can add field descriptions only for charts that are configured by using the chart-driven mode.

    • Field sorting: Click a field name, select Sort Type, and then select a sorting method. The following table describes the sorting methods that are available.

      Sorting methodDescription
      DefaultDo not sort the field.
      Ascending orderSort the field in ascending order in the SQL statement to be generated.
      Descending orderSort the field in descending order in the SQL statement to be generated.
      CustomizeYou can drag and drop to sort field values. In the chart to be generated, the field values will be displayed in the order as you set. Only categorical fields can be sorted by dragging and dropping.
  • Other configurations:

    • Size: If you are configuring a scatter chart, you need to put a field of the NUMERIC type in the Size area. The field is used to code points in terms of size. Values of the field will be aggregated in the SQL statement to be generated.
    • Prompt information: You can set prompts only for certain Cartesian charts. Only fields of the NUMERIC type can be put in the Prompt information area. Values of each field in this area will be aggregated in the SQL statement to be generated.
    • When you configure a chart by using the pivot-driven mode, you can put fields of any type in the Label area. Values of each categorical field in this area will be grouped and values of each field of the NUMERIC type will be aggregated in the SQL statement to be generated.
    • When you configure a scatter chart by using the pivot-driven mode, you need to put a field of the NUMERIC type in the x data axis area. The field is specified as the measure of X-axis. Values of the field will be aggregated in the SQL statement to be generated.
    • When you configure a dual Y-axis chart by using the chart-driven mode, you can specify a measure for the left Y-axis and a measure for the right Y-axis.

Chart configuration

After you finish configuring fields, you can select a chart type by clicking the corresponding icon at the top of the chart configuration section.

You can move the pointer over an icon to check the prerequisites of the chart type. If your data configuration does not meet all the prerequisites, the icon is dimmed. Only after all the prerequisites are met does the icon become highlighted. Click the icon and a chart appears in the chart display section.

On the Style tab in the chart configuration section, you can customize the chart display style.
11

Functionality settings

On the Settings tab in the chart configuration section, you can configure a filter and cache and specify whether to automatically load data.

  • Filter
    You can create a filter or edit an existing filter by clicking Settings to the right of Filter.

    To configure a filter, you must have defined variables when configuring the dataset.

    12

    After you add a chart with a filter to a dashboard, you can click the button in the upper-left corner of the dashboard card. On the filter panel that appears, specify filter conditions and then click Query in the lower-right corner of the panel. Conditions you specified in the chart filter and conditions you specified in the global filter of the dashboard take effect at the same time.

    13

  • Cache
    You can enable or disable cache for a chart. You can also set a validity period for cache.

    If you enable cache for a chart, the result of the first query for the chart on a dashboard or big screen will be stored in the cache. The SQL query statement will be used as a key. Within the validity period of the cache, the stored result will be returned for the same SQL query statement, with no need to access the data source.

  • Automatic data loading
    In scenarios where data query is frequent, you may not want data to be loaded immediately when you open a dashboard. In this case, you can set Automatically load data to No. This feature is set to Yes by default.

Procedure

Create a chart

  1. Log on to the DMS console.
  2. In the top navigation bar, choose Data Factory > Data Visualization.

    For more information about how to access the data visualization feature, see Access the data visualization feature.

  3. In the left-side navigation pane, click Chart.

  4. On the Chart management page, click 1.

    Alternatively, you can click Configure Chart in the Edit dataset model step.

  5. Complete dataset and chart configuration. For more information, see Features.

  6. Click Save in the upper-right corner.

Modify a chart

  1. Log on to the DMS console.
  2. In the top navigation bar, choose Data Factory > Data Visualization.

    For more information about how to access the data visualization feature, see Access the data visualization feature.

  3. In the left-side navigation pane, click Chart.

  4. On the Chart management page, find the target chart and click 1-3 in the Operation column. On the page that appears, you can modify the chart. For more information about dataset and chart configuration, see Features.

Delete a chart

  1. Log on to the DMS console.
  2. In the top navigation bar, choose Data Factory > Data Visualization.

    For more information about how to access the data visualization feature, see Access the data visualization feature.

  3. In the left-side navigation pane, click Chart.

  4. On the Chart management page, find the target chart and click 1-5 in the Operation column.
  5. In the message that appears, click OK. The chart will be immediately deleted.

Duplicate a chart

  1. Log on to the DMS console.
  2. In the top navigation bar, choose Data Factory > Data Visualization.

    For more information about how to access the data visualization feature, see Access the data visualization feature.

  3. In the left-side navigation pane, click Chart.

  4. On the Chart management page, find the target chart and click 13 in the Operation column.
  5. In the dialog box that appears, set Chart name and Description and click OK.