apache / apache/echarts

[Feature] Multiple parallel edges

Open
#18,424 7 comments 0 reactions 0 assignees View on GitHub
en new-feature topic: graph
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### What problem does this feature solve?

Especially to represent network topologies it would be nice to have the possibility to create parallel lines as edges (instead of curved ones). Through this feature it would be possible to obtain such a result.
![image](https://user-images.githubusercontent.com/50317336/227872477-143f61af-73b5-46ae-a62b-e7bc4b378a15.png)

### What does the proposed API look like?

In order to achieve the result above some steps are required:

- Introduce an `offset` field in `lineStyle` option. This field can be a percentage (e.g 20% of node size) or a static value (e.g 1). As I'm trying to implement this feature I noticed that the position of the links are rounded to integer, so the percentage could be complicated.
- Introduce a field `autoOffset` to set the auto computation of offsets when the graph has multiple edges between two nodes. This alternative would ensure full backwards compatibility. Alternatively a field could be added (e.g `parallelEdges`: `curve` | `offset`) to tell Echarts how to handle multiple edges.
In case there are too many edges between two nodes in the first instance an offset may not be applied. At a later stage, a label could be introduced to indicate how many 'collapsed' edges there are.

I can try to implement this feature and then open a PR, but I'll need someone to discuss some choices and questions.
Let me know.

Best regards,
Daniele

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.