edit-icon download-icon

Sankey diagram

Last Updated: Jun 04, 2018

Sankey diagram, a specific type of flow chart, is used to describe the flow from one set of values to another, and is applicable to scenarios such as network flow data. Generally, the Sankey diagram contains three sets of values: source, target, and value. source and target describes the edge relationship between nodes, and value describes the relationship between source and target.

Function features

The Sankey diagram has the following features:

  • The start flow is the same as the end flow. The overall width of all the main branches is the same as that of all the branches. Therefore, the energy balance is maintained.

  • Internally, different lines indicate the distribution of different flows, and the line width indicates the flow occupied by the branch proportionally.

  • Different node widths indicate the flows in the particular statuses.

For example, the following data can be displayed in a Sankey diagram.

Source Target Value
node1 node2 14
node1 node3 12
node3 node4 5
..

The Sankey diagram visualizes the preceding data as follows.

69572-1

Basic components

  • Node
  • Edge

Configuration items

Configuration item Description
Start column Describes the start node.
End column Describes the end node.
Numeric column The value that links the start node and the end node.
Padding The distance between the coordinate axis and the graph boundary.

Procedure

  1. On the query page, enter the query statement in the search box, select the time interval, and click Search.

  2. Click the Graph tab and select the Sankey diagram undefined.

  3. Configure the graph properties.

Examples

Ordinary Sankey diagram

If the log field contains source, target, and value, each log itself is the relationship between nodes and edges, and the sum of streamValue can be obtained using Nested subquery.

  1. * | select sourceValue, targetValue, sum(streamValue) as streamValue from (select sourceValue, targetValue, streamValue, __time__ from log group by sourceValue, targetValue, streamValue, __time__ order by __time__ desc) group by sourceValue, targetValue

69572-1en

Access logs of Layer-7 Server Load Balancer scenario

Log Service supports Access logs of Layer-7 Server Load Balancer, so you can use access logs to build a Sankey diagram.

  1. * | 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))

69572-2en

Thank you! We've received your feedback.