C4Model Diagrams #648
Replies: 5 comments 4 replies
-
This would be so great to have out-of-the-box. I went ahead and attempted a C4 diagram based on the image in OP to get an idea of what the code would look like if you wanted to create a C4 model diagram today. You can find it below. One thing I couldn't solve was expanding the "Sample System" container so that the type was not hidden behind the "Web Application" container. Also, the HTML is not necessary if you don't mind the content not being centered. You could also just use the label in this place, but the whole content would be bold, italic, underline, etc. depending on how you style it (i.e., you wouldn't be able to style each part individually when using a label). C4 model diagram in D2Admin: "" {
text: |md
<p align="center">
<strong>Administrator</strong><br />
[Person]
</p>
|
}
Sample System: "Sample System\n[System]" {
style: {
stroke-dash: 3
}
Web App: "" {
text: |md
<p align="center">
<strong>Web Application</strong><br />
[Container: C#, ASP.NET Core 2.1 MVC]<br />
Allows users to compare multiple Twitter timelines
</p>
|
}
}
Twitter: "" {
text: |md
<p align="center">
<strong>Twitter</strong><br />
[Software System]
</p>
|
}
Admin -> Sample System.Web App: "Uses\n[HTTPS]"
Sample System.Web App -> Twitter: "Gets tweets from\n[HTTPS]" |
Beta Was this translation helpful? Give feedback.
-
just as an update, the work for this is merged: (the layers part of this PR) #714 we'll be writing docs and cut a release over the coming week |
Beta Was this translation helpful? Give feedback.
-
Here's the plantuml code for the OP diagram
|
Beta Was this translation helpful? Give feedback.
-
Can we get a C4 theme example and a few of the C4 icons added to the icons site? |
Beta Was this translation helpful? Give feedback.
-
I'll be dedicating some time to support C4 diagrams in D2 in the coming days. Tracking list of TODOs. Once these are done, C4 diagrams should be fully supported. If someone looks through this and thinks there's something missing, please let me know. |
Beta Was this translation helpful? Give feedback.
-
Currently I use PlantUML for most of my diagrams along with C4-PlantUML to do C4Model. I've been playing around with d2 and feel the syntax is somewhat better than PlantUML, however, I cannot find a clean way to create C4Model diagrams. I can kind of do it with nested icons and markdown, but it's kind of kludgy and doesn't look anywhere near as clean as C4-PlantUML diagrams.
It would be nice if there were a way to create an object with:
And have it render as a single component. A simple C4 diagram would looks something like this:
Beta Was this translation helpful? Give feedback.
All reactions