mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Update docs
This commit is contained in:
parent
abb7bb23d6
commit
c327ea9f21
@ -318,52 +318,92 @@ Wind,Electricity grid,289.366
|
|||||||
|
|
||||||
The idea behind syntax is that a user types `sankey-beta` keyword first, then pastes raw CSV below and get the result.
|
The idea behind syntax is that a user types `sankey-beta` keyword first, then pastes raw CSV below and get the result.
|
||||||
|
|
||||||
It is implements standard as [described here](https://www.ietf.org/rfc/rfc4180.txt) with subtle **differences**:
|
It implements CSV standard as [described here](https://www.ietf.org/rfc/rfc4180.txt) with subtle **differences**:
|
||||||
|
|
||||||
- CSV must contain **3 columns only**
|
- CSV must contain **3 columns only**
|
||||||
- It is **allowed** to have **empty lines** without comma separators for visual purposes
|
- It is **allowed** to have **empty lines** without comma separators for visual purposes
|
||||||
|
|
||||||
### Empty lines
|
### Basic
|
||||||
|
|
||||||
CSV does not support empty lines (without comma delimeters) by default. But you can add them if needed.
|
It is implied that 3 columns inside CSV should represent `source`, `target` and `value` accordingly:
|
||||||
|
|
||||||
|
```mermaid-example
|
||||||
|
sankey-beta
|
||||||
|
|
||||||
|
%% source,target,value
|
||||||
|
Electricity grid,Over generation / exports,104.453
|
||||||
|
Electricity grid,Heating and cooling - homes,113.726
|
||||||
|
Electricity grid,H2 conversion,27.14
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sankey-beta
|
||||||
|
|
||||||
|
%% source,target,value
|
||||||
|
Electricity grid,Over generation / exports,104.453
|
||||||
|
Electricity grid,Heating and cooling - homes,113.726
|
||||||
|
Electricity grid,H2 conversion,27.14
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid-example
|
||||||
|
sankey-beta
|
||||||
|
|
||||||
|
%% source,target,value
|
||||||
|
Electricity grid,Over generation / exports,104.453
|
||||||
|
Electricity grid,Heating and cooling - homes,113.726
|
||||||
|
Electricity grid,H2 conversion,27.14
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sankey-beta
|
||||||
|
|
||||||
|
%% source,target,value
|
||||||
|
Electricity grid,Over generation / exports,104.453
|
||||||
|
Electricity grid,Heating and cooling - homes,113.726
|
||||||
|
Electricity grid,H2 conversion,27.14
|
||||||
|
```
|
||||||
|
|
||||||
|
### Empty Lines
|
||||||
|
|
||||||
|
CSV does not support empty lines without comma delimeters by default. But you can add them if needed:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Bio-conversion,Liquid,0.597
|
|
||||||
Bio-conversion,Losses,26.862
|
Bio-conversion,Losses,26.862
|
||||||
|
|
||||||
Bio-conversion,Solid,280.322
|
Bio-conversion,Solid,280.322
|
||||||
|
|
||||||
Bio-conversion,Gas,81.144
|
Bio-conversion,Gas,81.144
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Bio-conversion,Liquid,0.597
|
|
||||||
Bio-conversion,Losses,26.862
|
Bio-conversion,Losses,26.862
|
||||||
|
|
||||||
Bio-conversion,Solid,280.322
|
Bio-conversion,Solid,280.322
|
||||||
|
|
||||||
Bio-conversion,Gas,81.144
|
Bio-conversion,Gas,81.144
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Bio-conversion,Liquid,0.597
|
|
||||||
Bio-conversion,Losses,26.862
|
Bio-conversion,Losses,26.862
|
||||||
|
|
||||||
Bio-conversion,Solid,280.322
|
Bio-conversion,Solid,280.322
|
||||||
|
|
||||||
Bio-conversion,Gas,81.144
|
Bio-conversion,Gas,81.144
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Bio-conversion,Liquid,0.597
|
|
||||||
Bio-conversion,Losses,26.862
|
Bio-conversion,Losses,26.862
|
||||||
|
|
||||||
Bio-conversion,Solid,280.322
|
Bio-conversion,Solid,280.322
|
||||||
|
|
||||||
Bio-conversion,Gas,81.144
|
Bio-conversion,Gas,81.144
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -399,55 +439,41 @@ Pumped heat,"Heating and cooling, homes",193.026
|
|||||||
Pumped heat,"Heating and cooling, commercial",70.672
|
Pumped heat,"Heating and cooling, commercial",70.672
|
||||||
```
|
```
|
||||||
|
|
||||||
### Double quotes
|
### Double Quotes
|
||||||
|
|
||||||
If you need to have double quote, put a pair of them:
|
If you need to have double quote, put a pair of them inside quoted string:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Pumped heat,"Heating and cooling ""homes""",193.026
|
Pumped heat,"Heating and cooling, ""homes""",193.026
|
||||||
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Pumped heat,"Heating and cooling ""homes""",193.026
|
Pumped heat,"Heating and cooling, ""homes""",193.026
|
||||||
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Pumped heat,"Heating and cooling ""homes""",193.026
|
Pumped heat,"Heating and cooling, ""homes""",193.026
|
||||||
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sankey-beta
|
sankey-beta
|
||||||
|
|
||||||
Pumped heat,"Heating and cooling ""homes""",193.026
|
Pumped heat,"Heating and cooling, ""homes""",193.026
|
||||||
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
### Coloring and Alignment
|
You can customize link colors, node alignments and diagram dimensions.
|
||||||
|
|
||||||
You can change graph layout by setting `nodeAlignment` to:
|
|
||||||
|
|
||||||
- `justify`
|
|
||||||
- `center`
|
|
||||||
- `left`
|
|
||||||
- `right`
|
|
||||||
|
|
||||||
And adjust coloring of the links by setting `linkColor` to one of those:
|
|
||||||
|
|
||||||
- `source`
|
|
||||||
- `target`
|
|
||||||
- `gradient`
|
|
||||||
- hex code of color, like `#a1a1a1`
|
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script>
|
<script>
|
||||||
@ -455,6 +481,8 @@ And adjust coloring of the links by setting `linkColor` to one of those:
|
|||||||
startOnLoad: true,
|
startOnLoad: true,
|
||||||
securityLevel: 'loose',
|
securityLevel: 'loose',
|
||||||
sankey: {
|
sankey: {
|
||||||
|
width: 800,
|
||||||
|
height: 400,
|
||||||
linkColor: 'source',
|
linkColor: 'source',
|
||||||
nodeAlignment: 'left',
|
nodeAlignment: 'left',
|
||||||
},
|
},
|
||||||
@ -462,3 +490,21 @@ And adjust coloring of the links by setting `linkColor` to one of those:
|
|||||||
mermaid.initialize(config);
|
mermaid.initialize(config);
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Links Coloring
|
||||||
|
|
||||||
|
You can adjust links' color by setting `linkColor` to one of those:
|
||||||
|
|
||||||
|
- `source` - link will be of a source node color
|
||||||
|
- `target` - link will be of a target node color
|
||||||
|
- `gradient` - link color will be smoothly transient between source and target node colors
|
||||||
|
- hex code of color, like `#a1a1a1`
|
||||||
|
|
||||||
|
### Node Alignment
|
||||||
|
|
||||||
|
Graph layout can be changed by setting `nodeAlignment` to:
|
||||||
|
|
||||||
|
- `justify`
|
||||||
|
- `center`
|
||||||
|
- `left`
|
||||||
|
- `right`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user