Cross tables are mainly used in data analysis scenarios. You can use cross tables to extract useful data from a large amount of log data in an efficient manner and visualize the extracted data. This topic describes how to configure a cross table. This topic also provides examples of cross tables.
Overview
A cross table is a form of table layout that allows you to view the data of two or more variables at a time. In a cross table, the categories of one variable are listed in the rows of the cross table and the categories of another variable are listed in the columns of the cross table. Each cell in a cross table displays the number of occurrences or the ratio for two variables based on the specified category combination.
For more information about the entry point to add a cross table, see Add a chart to a dashboard.
Configuration example
Log on to the Simple Log Service console. In the Projects section, click the project you want.
In the left-side navigation pane, choose Dashboard > Dashboards. In the dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, click Add > Add Chart.
On the right side of the Edit Chart page, select Cross Table in the Chart Types section and configure parameters in the Query and Analysis Configurations section based on the following figure. On the left side of the Edit Chart page, configure the query time range, Logstore, and query statement for the cross table. After you complete the configuration, click Apply in the upper part of the Edit Chart page to view the configuration effects of the cross table.
The following query statement is used to query the number of requests per minute by request method:
* | SELECT minute, c, request_method from ( select date_format(from_unixtime(__time__ - __time__% 60), '%H:%i') as minute, count(1) as c, request_method from log group by minute, request_method order by minute asc limit 100000)
Configuration on the General Configurations tab
You can configure global settings for a cross table on the General Configurations tab.
Parameters in the Basic Configurations section
Parameter
Description
Title
The title of the cross table.
Display Title
If you turn on Display Title, the title of the cross table is displayed.
Display Border
If you turn on Display Border, the borders of the cross table are displayed.
Display Background
If you turn on Display Background, the background color of the cross table is displayed.
Display Time
If you turn on Display Time, the query time range of the cross table is displayed.
Fixed Time
If you turn on Fixed Time, the query time range of the cross table is independent of the global time range of the dashboard.
Parameters in the Standard Configurations section
Parameter
Description
Format
The display format of numeric values.
Unit
The unit of numeric values.
Number of Digits after Decimal Point
The decimal places of numeric values.
Display Name
The name of the table header.
If you specify a value for the Display Name parameter, the value is used as the names for all headers in the cross table. If you want to change the name of a header, you can configure parameters on the Field Configuration tab.
Color Scheme
The color scheme that specifies the background color and text color of the cross table. Valid values:
Built-in: uses the built-in color scheme.
Solid: uses the color that you select.
Threshold: uses different colors for different values based on the specified thresholds for the values.
Parameters in the Query and Analysis Configurations section
Parameter
Description
Aggregate Column
The field that you want to use to aggregate data.
Metric Column
The metric whose value you want to display in the cross table.
Category Column
The field that you want to use to categorize data.
Parameters in the Table Configurations section
Parameter
Description
Display Mode
The display mode of the cross table. Valid values:
Paging: The cross table is displayed by page. You can configure the Items Per Page parameter to specify the number of rows that you want to display on each page.
Contour: The cross table is displayed on one page. You can configure the Row Height parameter to specify the height of rows that you want to display on one page.
Display Header
If you turn on Display Header, the headers of the cross table are displayed.
Total
If you turn on Total, the total number of rows is displayed in the cross table.
Transparent Background
If you turn on Transparent Background, the background in the cross table is transparent.
Show Progress Bar Tag
If you turn on Show Progress Bar Tag, the progress is displayed as a numeric value on the progress bar.
This parameter setting takes effect only when you set the Cell Display Mode parameter to Progress Bar, LCD Progress Bar, or Gradient Progress Bar.
Parameters in the Field/Column Settings section
Parameter
Description
Minimum Column Width
The minimum column width of the cross table. Unit: pixels.
If you retain auto for the Column Width parameter, the column width of the cross table is greater than or equal to the value of the Minimum Column Width parameter.
Column Width
The minimum column width of the cross table.
Maximum Value
The maximum value of the progress bar. If you retain auto for the Maximum Value parameter, the maximum value of the column is used.
Cell Display Mode
The display mode of cells.
If you set this parameter to Hide, the settings of colors and thresholds become invalid.
Alignment Method
The alignment method of the content in cells.
Disable Sorting
If you turn on Disable Sorting, sorting is disabled.
Disable Searching
If you turn on Disable Search, searching is disabled.
Search Mode
The mode for searching data in the cross table. Valid values:
Search: searches for a specific metric value. The icon is displayed in the table header.
Filter: filters for a specific metric value. The icon is displayed in the table header.
Multiple Choices
Specifies whether to enable multiple selections when you search data in the cross table. If you select Multiple-choice, you can specify multiple metric values in the search box or filter box.
Exact Search
If you turn on Exact Search, only the metric values that exactly match the specified conditions are returned.
If you turn off Exact Search, you can perform fuzzy search. For example, if you search for
abc
, all values that containabc
are returned.
Font Size
The font size of the content in cells.
Parameters in the Threshold section
Parameter
Description
Threshold Mode
The threshold mode. Valid values:
Absolute Value: specifies threshold values as absolute values.
Percentage: specifies threshold values as percentages.
Threshold
The threshold of numeric values.
If you set the Color Scheme parameter to Threshold and specify thresholds in the Threshold section, the text and background of the cross table are displayed in different colors based on the specified thresholds.
Parameters in the Variable Replacement section
Parameter
Description
Variable Replacement
The settings for variable replacement. You can click AddVariable Replacement to add a filter of the Variable Replacement type to the cross table. After you configure the settings for variable replacement on the General Configurations tab, Simple Log Service adds a filter in the upper-left corner of the cross table. You can select a value from the filter drop-down list. After you select a value, Simple Log Service automatically replaces the variable in the query statement of the cross table with the variable value indicated by the value that you select, and performs a query and analysis operation. For more information, see Example 2: Configure variable replacement.
Parameters in the Value Mapping section
Parameter
Description
Value Mapping
The text or icon that you want to use to replace a specified value in the cross table.
For example, if you set the Value parameter to 200, the Mapping Type parameter to Text, and the Mapping Value parameter to Success, all values of 200 in the cross table are replaced with Success.
Parameters in the Documentation section
Parameter
Description
Add Documentation Link
The button that allows you to specify custom document links and descriptions. After you configure the settings, the specified information is displayed in the upper right corner of the cross table.
Configuration on the Field Configuration tab
You can configure personalized display settings for the results of a single query statement or for a single column of data in the results. For more information, see Configuration on the General Configurations tab.
For example, you can select A > minute to configure settings for the minute field in the results of Query Statement A. You can select A > c to configure settings for the c field in the results of Query Statement A. After you specify the color scheme and cell display mode for the two fields, you can distinguish the fields in the cross table by color.
Configuration on the Interaction Occurrences tab
You can configure an interaction occurrence for the results of a single query statement or for a single column of data in the results to analyze data in a finer-grained manner. Supported types of interaction occurrences include Open Logstore, Open Saved Search, Open Dashboard, Open Trace Analysis, Open Trace Details, and Create Custom HTTP URL. For more information, see Interaction occurrences.
For example, you can select A > count to configure an Open Logstore interaction occurrence for the count field in the results of Query Statement A. After you configure the interaction occurrence, you can move the pointer over a value of the count field of the cross table and click Open Logstore. Then, you are navigated to the Logstore that you specify.