D2Lang

[D2Lang] 2. D2를 통한 다이어그램 상자의 모양 바꾸기!

o0zrone 2023. 4. 16. 12:40
728x90

매우 간단하게 변경하실 수 있습니다.

d2에서 모양을 바꾸는 방법은 그냥 (개체 이름).shape 뒤에 지원되는 모양을 적으시면 됩니다.

 

아래 예제는 지원하는 모양을 정리해둔 예제입니다.

이외에는 special shape types라고 있는데 나중에 따로 정리하겠습니다.

 

일단 grid-rows: 4로 모양들을 4행으로 정리했습니다.

grid-rows: 4

rectangle.shape: rectangle
square.shape: square
page.shape: page
parallelogram.shape: parallelogram
document.shape: document
cylinder.shape: cylinder
queue.shape: queue
package.shape: package
step.shape: step
callout.shape: callout
stored_data.shape: stored_data
person.shape: person
diamond.shape: diamond
oval.shape: oval
circle.shape: circle
hexagon.shape: hexagon
cloud.shape: cloud

아래의 이미지가 결과입니다.

 

아래의 이미지처럼 여러모양을 지원하고 있습니다.

결과

 

그러면 어떻게 화살표로 이어야 할지 알려드리겠습니다.

cloud.shape: cloud
document.shape: document
rectangle.shape: rectangle
page.shape: page

cloud -> document -> rectangle -> page

개체의 모양을 설정했다 생각하시고 개체끼리 화살표로 연결해 주시면 아래와 같이 이어집니다.

결과

그러면 화살표까지 이어봤으니 그럴싸하게 모양안의 텍스트를 바꿔 보겠습니다.

cloud: server
document: hidden process
rectangle: hidden process
page: web page

cloud.shape: cloud
document.shape: document
rectangle.shape: rectangle
page.shape: page

cloud -> document -> rectangle -> page

위의 코드와 같이 개체 이름 뒤에 ':'을 붙이고 들어갈 내용을 적으시면 됩니다.

텍스트를 바꾼 모습

 

 

이런 방식이 아니라 내용을 수정하는 다른 방법이 있는데 그것은 나중에 글로 찾아뵙겠습니다

 

다음 글은 화살표의 모양을 바꿔보겠습니다.

감사합니다.