선릉역 1번 출구

[D2] 다이어그램 및 도표 생성(1) 본문

etc

[D2] 다이어그램 및 도표 생성(1)

choideu 2023. 1. 23. 11:56

다이어그램과 도표를 편하게 생성할 수 있는 D2(diagram scripting language).

https://play.d2lang.com/?script=qlDQtVOo5AIEAAD__w%3D%3D& 

 

D2 Playground

An online runner to play, learn, and create with D2, the modern diagram scripting language that turns text to diagrams.

play.d2lang.com

 

1. 방향 그래프 생성

x--y
x -> y
x <-> y

1, 2, 3

dogs -> cats -> mice: chase
위와 같은 구문을 통해 3개의 연결도 생성 가능
 

2. 화살표에 관계 표시하기

x: choideu
y: peach
x -> y: eat

2-1. 화살표 꾸미기

a <-> b: To err is human, to moo bovine {
  source-arrowhead: 1 
  target-arrowhead: * {
    shape: diamond
  }
}

글 작성 이후에 중괄호를 이용해서 화살표 꾸미기 가능

 

3. 도형 shape 지정 방법

1. donut: {shape: circle}
2. database.shape: cylinder
3. you: {
  shape: person
}

 

응용 버전

x: choideu {shape: person}
y: peach {shape: cylinder}
x -> y: eat {
  source-arrowhead: 1
  target-arrowhead: * {shape: diamond}
}

'etc' 카테고리의 다른 글

[D2] 다이어그램 및 도표 생성(2)  (0) 2023.01.25
취업  (0) 2022.03.15
Comments