I am trying to add a background to my flow chart and group them into two, Received by Server and Transmitted from Server.
Relevant Research:
I have tried to understand and modify the codes from:
- Example: Schema of Labs on a class
- Example: System Combination
but couldn't get it right.
MWE:
\documentclass[a4paper, 11pt]{report}
\usepackage[toc,page]{appendix}
\usepackage{pgfgantt}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shadows}
\usetikzlibrary{fit,backgrounds} % <-added
\usetikzlibrary{shadows.blur}
\begin{document}
\begin{center}
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt, drop shadow]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=7em, text centered, rounded corners, minimum height=2em, drop shadow]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
minimum height=2em, drop shadow]
\tikzset{rect/.style={rectangle, rounded corners, minimum width=3.5cm, minimum
height=1cm,text centered, draw=black, fill=blue!10,blur shadow},
arrow/.style={thick,->,>=stealth}}
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [block] (TCSBox) {TCS Box};
\node [block, below of=TCSBox] (scraper) {Python Scraper};
\node [block, below of=scraper] (db) {Database};
\node [block, right of=db, node distance=6cm] (tx) {Outgoing files directory};
\node [block, below of=db] (dash) {Dashboard};
\node [block, right of=dash, node distance=6cm] (reconfig) {Create New Reconfig File};
\node [block, below of=dash] (ui) {User Interface};
\node [decision, below of=ui] (decide) {Changed?};
\node [cloud, below of=decide] (end) {End};
label={[font=\small\sffamily,name=label1,xshift=-3mm]above right:{Transmitted by Server}}] {Outoing files directory};
label={[font=\small\sffamily,name=label2,xshift=3mm]above left:{Received to Server}}] {Python Scraper};
% Draw edges
\path [line] (TCSBox) -- (scraper);
\path [line] (scraper) -- (db);
\path [line] (db) -- (dash);
\path [line] (dash) -- (ui);
\path [line] (ui) -- (decide);
\path [line] (reconfig) -- (tx);
\path [line] (tx) |- (TCSBox);
\path [line] (decide) -| node[near start]{Yes} (reconfig);
\path [line] (decide) -- node {No}(end);
\begin{scope}[on background layer]
\tikzset{myfit/.style={draw,dashed,gray,rounded corners,fill=yellow!50,
inner sep=10pt}}
\node[myfit,fit=(scraper) (db) (dash) (ui) (label1.east)]{};
\node[myfit,fit=(reconfig) (tx) (label2.west)]{};
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}
Current Output:
Ideal Output:
Question:
How can change my MWE code to get the ideal output?