Skip to content

Sankey diagram alias support #6178

Open
@TomasHubelbauer

Description

@TomasHubelbauer

Proposal

I searched around to see if there were any issues related to aliases for names related to Sankey diagrams and found nothing.

By aliases I mean the same concept as found in e.g. sequence diagrams: https://mermaid.js.org/syntax/sequenceDiagram.html#aliases

I am aware that Sankey diagrams are in beta, so the lack of such functionality is not surprising, however I want to make sure to make a case for this, because the way the Sankey documentation reads right now, it seems pretty set on interpreting three-columnar CSVs with little to no wiggle room for any sort of authoring improvements like aliases would be:

The idea behind syntax is that a user types sankey-beta keyword first, then pastes raw CSV below and get the result.

I propose adding support for mapping aliases to names atop the section where the CSV goes so that it can be placed in easily and not have to be wrangled itself, but names could still be aliased via the definition which would live in its own section. Please see the example below.

In this scenario, the raw data can contain short names or identifiers and be easily pastable in and it would still be possible to easily and swiftly remap some or all of these names to more appropriate display names without doing a replace on the raw CSV contents and meticulously trying to keep everything in check.

This would be especially beneficial whenever a Sankey diagram would be getting regenerated, because the raw data could be replaced without affecting the alias map incurring no extra work to repeat the same renames on the new dataset.

Example

```mermaid
sankey-beta

A = Alice
B = Bob
C = Chad

A,B,100
A,C,100
```

Screenshots

Before:

```mermaid
sankey-beta

A,B,100
A,C,100
```
image

After:

```mermaid
sankey-beta

A = Alice
B = Bob
C = Chad

A,B,100
A,C,100
```
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions