A Sankey diagram uses the width of flows to visualize traffic, weight, or other measures between different nodes. This topic describes the basic configurations and provides an example of a Sankey diagram.
Introduction
A Sankey diagram is a type of flow chart that shows the flow from one set of values to another. It is suitable for scenarios such as visualizing network traffic. A Sankey diagram typically contains three sets of values: source, target, and value. The source and target values define the link between nodes, and the value specifies the weight of the edge between the source and target nodes.
It consists of the following basic components:
Nodes
Edges
For example, the following data can be represented by a Sankey diagram.
source | target | value |
node1 | node2 | 14 |
node1 | node3 | 12 |
node3 | node4 | 5 |
… | .. | … |
The following Sankey diagram visualizes the relationships in the preceding data.
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 . In the Dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, choose .
-
In the right-side panel, configure Chart Type, Query and Analysis Configurations, and Chart Configurations. In the left-side panel, set the time range, select a Logstore, and enter a query statement. Then, click Apply at the top of the page to view the chart.
The query statement to summarize network request data is as follows:
* | select COALESCE(client_ip, slbid, host) as source, COALESCE(host, slbid, client_ip) as dest, sum(request_length) as inflow group by grouping sets( (client_ip, slbid), (slbid, host))Set Logstore to website_log and chart type to sankey diagram. In the query and analysis configuration section, set source column to source, end column to dest, and value column to inflow. In the chart configuration section, set link color to Source Node and alignment to Center.
You can also configure multiple query statements to visualize the flow between multiple nodes. The following example shows how to configure the flow between the
slbid,client_ip, andhostnodes.Set the chart type to sankey diagram and the data source to website_log. In the query and analysis configuration section, configure the queries as follows: For Query A, set source column to
slbid, end column toclient_ip, and value column toinflow. For Query B, set source column toclient_ip, end column tohost, and value column toinflow.Query A: Calculates the total request traffic from different clients that passes through different Server Load Balancer instances.
* | select slbid,client_ip,sum(request_length) as inflow group by client_ip,slbid order by client_ip limit 10Query B: Calculates the traffic distribution between clients and hosts.
* | select client_ip,host,sum(request_length) as inflow group by host,client_ip order by client_ip limit 10Simple Log Service and Classic Load Balancer (CLB) provide a Layer 7 access log feature to record the details of all requests that are sent to a CLB instance. The details include the request time, client IP address, latency, URI of the request, and server response. You can use Layer 7 access logs to create a Sankey diagram. For more information, see Enable the access log feature.
General configuration
Configure global settings for the Sankey diagram.
-
Basic configurations
Parameter
Description
Title
The chart title.
Display Title
Displays the chart title when enabled.
Display Border
Displays a border around the chart when enabled.
Display Background
Displays a background color in the chart when enabled.
Display Time
Displays the query time in the chart when enabled.
Fixed Time
Fixes the query and analysis time range so that it is not affected by the global time of the dashboard.
-
Standard configurations
Parameter
Description
Format
The display format for numbers.
Unit
The unit for numbers.
Number of Digits after Decimal Point
The number of decimal places for numbers.
Display Name
The display name for the field.
This name overrides all other field names in the chart. To rename a specific field, use field configuration instead.
Color Scheme
The color scheme for the chart.
-
Built-in: Uses the built-in colors.
-
Solid: Uses a single color.
-
Threshold: Colors the chart based on configured thresholds.
-
-
Query and Analysis Configurations
Parameter
Description
Start Column
The source node.
End Column
The target node.
Value Column
The traffic value between the source node and the target node.
-
Chart Configurations
Parameter
Description
Connection Line Color
Set the color of the links.
Alignment Mode
Set the alignment of the chart.
-
Thresholds
Parameter
Description
Threshold
Set thresholds for the data.
If you set Color Scheme to Threshold and configure a threshold here, the chart background is displayed in the corresponding threshold color.
-
Variable substitution
Parameter
Description
Variable substitution
Variable substitution adds a variable-type filter to the chart. After configuration in General configurations, a filter appears in the upper-left corner of the chart. When you select a value, Simple Log Service replaces the variable in the query statement and reruns the analysis. Example 2: Set variable substitution.
-
Documentation
Parameter
Description
Add Documentation Link
Add a custom documentation link or description. After the configuration, the information is displayed in the upper-right corner of the Sankey diagram.
Field configuration
You can use field configuration to customize the visualization settings for the results of a specific query or for a specific column in the results. For more information about the configuration items, see General configuration.
For example, A > source indicates that you are configuring the source field in the results of Query A. In this example, the color is set to Solid.
Interaction events
You can use interaction events to configure interactions for the results of a specific query or for a specific column in the results to perform in-depth data analysis. Interaction events include Open Logstore, Open Saved Search, Open Dashboard, Open Trace Analysis, Open Trace Details, and Custom HTTP Link. For more information, see Add interaction events to a dashboard for drill-down analysis.
For example, A indicates that you are configuring an interaction event for the results of Query A. If you set the event to Open Logstore, you can click any part of the chart that is related to Query A and then click Open Logstore to navigate to the specified Logstore.