You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "konewka17 (via GitHub)" <gi...@apache.org> on 2026/03/31 18:30:58 UTC

[I] [Feature] Sankey: allow disabling automatic node sorting while still using positioning iterations [echarts]

konewka17 opened a new issue, #21561:
URL: https://github.com/apache/echarts/issues/21561

   ### What problem does this feature solve?
   
   Currently, the Sankey layout algorithm automatically sorts nodes within each depth level to optimize link crossings and visual clarity. While this behavior is generally helpful, it makes it difficult to enforce a **custom semantic ordering** of nodes within the same level.
   
   In certain use cases, the order of nodes within a level carries meaning (for example: logical flow, ranking, process stages, or domain-specific grouping). When the layout algorithm reorders nodes, this meaning can be lost or the diagram may become harder to interpret.
   
   One workaround is to set `layoutIterations: 0`, which prevents the collision resolution steps that modify node positioning. However, this also disables desirable layout improvements such as:
   
   - vertical alignment optimization
   - improved edge positioning
   - collision resolution adjustments
   - balanced spacing between nodes
   
   As a result, all nodes in each level become aligned at the top, producing a suboptimal layout that often requires manual positioning adjustments.
   
   This feature would allow developers to:
   
   - preserve the **input order of nodes within each depth level**
   - still benefit from automatic layout improvements
   - maintain predictable and stable diagram structures across updates
   - apply domain-specific ordering logic without losing layout quality
   
   This capability is particularly useful for dashboards, reports, and analytical tools where the vertical order communicates meaning beyond topology alone.
   
   The goal is to provide a way to **disable intra-level sorting** while keeping all other layout optimizations active.
   
   ### What does the proposed API look like?
   
   Add a new optional configuration property on Sankey series:
   
   ```ts
   series: {
     type: "sankey",
     sortNodes: false
   }
   ```
   
   ### Default behavior
   
   ```ts
   sortNodes: true
   ```
   
   This ensures full backward compatibility and preserves the current layout behavior unless explicitly disabled.
   
   ### Behavior when `sortNodes: false`
   
   When disabled:
   
   - the vertical order of nodes within each depth level follows the original order defined in `data`
   - the layout algorithm still performs:
     - node depth calculation
     - node scaling
     - collision resolution
     - Gauss–Seidel relaxation
     - link positioning
     - link thickness calculation
   
   Only the per-level sorting step is skipped.
   
   ### Example
   
   ```ts
   option = {
     series: {
       type: "sankey",
       sortNodes: false,
       data: [
         { name: "A" },
         { name: "B" },
         { name: "C" }
       ],
       links: [
         { source: "A", target: "C", value: 5 },
         { source: "B", target: "C", value: 3 }
       ]
     }
   }
   ```
   
   In this case, nodes **A**, **B**, **C** remain in the specified order within their levels, while layout optimization still improves spacing and link placement.
   
   ---
   
   This feature provides a balance between:
   
   - deterministic layout control
   - automatic visual optimization
   
   It solves a common need when working with structured or semantically ordered data, without requiring manual layout or disabling iterative refinement entirely.
   
   The API remains minimal and consistent with existing configuration patterns in ECharts, and provides a nicer alternative to setting `layoutIterations` to `0`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Feature] Sankey: allow disabling automatic node sorting while still using positioning iterations [echarts]

Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia closed issue #21561: [Feature] Sankey: allow disabling automatic node sorting while still using positioning iterations
URL: https://github.com/apache/echarts/issues/21561


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org