nordhagen
nordhagen

Reputation: 59

How to remove attribute from tikz ER diagram?

I am working with a project on VMC, where I need to present the structure of the code. I tried to use an ER diagram, but I am not able to remove the last attribute from the entity. The code looks as following

\usepackage{tikz}
\usetikzlibrary{er,positioning}

--

\begin{tikzpicture}[auto,node distance=1.5cm]
  \node[entity] (node1) {VMC}
    %[grow=down,sibling distance=4cm]
    child {node[attribute] {Attribute 1}};
  \node[entity] (node2) [below right = of node1] {WF};
  \node[entity] (node3) [below left = of node1] {Main};
  \node[entity] (node4) [below right = of node3] {GD};
  \node[relationship] (rel1) [above = of node4, below = of node1] {Tools};

  \path (node1) edge node {} (node2)
                edge node {} (node3)
                edge node {} (rel1);
  \path (node4) edge node {} (node2)
                edge node {} (node3)
                edge node {} (rel1);
\end{tikzpicture}

and the diagram looks like this

enter image description here

It is kind of what I want, but I would like to remove the attribute box and move the Tools box up to the center. Hope someone can help me with this, I am new to tikz.

Upvotes: 0

Views: 294

Answers (1)

pchaigno
pchaigno

Reputation: 13113

As far as I understand the question, you only need to remove the corresponding Attribute 1 code and add a distance from rel1 to node1:

\begin{tikzpicture}[auto,node distance=1.5cm]
  \node[entity] (node1) {VMC}
    %[grow=down,sibling distance=4cm]
    child {};
  \node[entity] (node2) [below right = of node1] {WF};
  \node[entity] (node3) [below left = of node1] {Main};
  \node[entity] (node4) [below right = of node3] {GD};
  \node[relationship] (rel1) [below=1cm of node1] {Tools};

  \path (node1) edge node {} (node2)
                edge node {} (node3)
                edge node {} (rel1);
  \path (node4) edge node {} (node2)
                edge node {} (node3)
                edge node {} (rel1);
\end{tikzpicture}

enter image description here

Upvotes: 1

Related Questions