class-diagramplantumlcomponent-diagram

PlantUML Class-/Component Diagram


I'm new to using PlantUML and would like some clarification if some specific actions are even possible or how they could be solved otherwise!

  1. Class Diagram: How to address relationships from a whole package (3 different classes) to one specific class in another package

  2. Component Diagram: How to address a relationship from an actor to a component? How to change packagestyle to different styles such as <>, <> etc.

This is the code I have tried for creating a relationship between actor and component, but it clearly doesn't work ^^':

package "StudyFun: Systemkontextdiagramm - Gesamsystem" {
allowmixing

Schüler --> [comp1]

component comp1 [
    <<business system>> 
        <b>StudyFun</b>]

actor Schüler

}

As seen in the picture, I would just want to create a line between Actor and component, if it can be solved without creating a relationship, please let me know :)

Current diagram


Solution

  • For question 1 (I'm not sure what you tried). It can work like this:

    @startuml Package-to-class
    skinparam style strictuml
    hide empty members
    package P1 {
        class A
        class B
        class C
    }
    package P2 {
        class X
        class Y
    }
    ' link from pacage to class
    P1 ..> X
    @enduml
    

    enter image description here

    For question 2, just put the association after the declaration of the other things:

    @startuml
    allowmixing
    package "StudyFun: Systemkontextdiagramm - Gesamsystem" {
    
    component comp1 [
        <<business system>> 
            <b>StudyFun</b>]
    
    actor Schüler
    
    Schüler --> comp1
    
    }
    @enduml
    

    enter image description here