2

I am creating a chevron chart using tikz and am having trouble with two issues:

  • it is too long and going out of my document

  • I figure that a change to the width (linewidth long) would also need a line break for longer text, else the text would go out of the chevron (only my noobish guess here)

Here is my example

\begin{figure}[h]
\centering
    \begin{tikzpicture}
      \tikzset{
        arrow/.style={
          draw,
          minimum height=2cm,
          shape=signal,
          signal from=west,
          signal to=east,
          signal pointer angle=110,
        }
      }
      \begin{scope}[start chain=transition going right,node distance=0, draw=blueaccent, distance=\linewidth]
        \node[arrow,on chain] {Auswahl};
        \node[arrow,on chain] {Exploration};
        \node[arrow,on chain] {Stichprobenziehung};
        \node[arrow,on chain] {Vorverarbeitung};
        \node[arrow,on chain] {Transformation};
        \node[arrow,on chain] {Wissensgewinnnung};
      \end{scope}
    \end{tikzpicture}
    \caption{Data Mining Prozess}
    \label{fig:DataMiningProzess}
\end{figure}

distance=\linewidth does not seem to have any effect and width is not a recognized option for scope. I also looked at these two question/answers but the dealt with nodes itself but not with a chevron shape (if I am not mistaken).

Manual/automatic line breaks and text alignment in TikZ nodes

Tikzpicture: Line break in node label to right

  • EDIT

I got the chevron code from this answer : Best way to draw a chevron diagram using Tikz

MEW:

\documentclass[fontsize=12pt,a4paper,oneside, 
listof=totoc,                   % Tabellen- und Abbildungsverzeichnis ins Inhaltsverzeichnis
bibliography=totoc,             % Literaturverzeichnis ins Inhaltsverzeichnis aufnehmen
titlepage,                      % Titlepage-Umgebung statt \maketitle
headsepline,                    % horizontale Linie unter Kolumnentitel
%abstracton,                    % Überschrift beim Abstract einschalten, Abstract muss dazu in {abstract}-Umgebung stehen
DIV12,                          % auskommentieren, um den Seitenspiegel zu vergrößern
BCOR=0mm,                       % Bindekorrektur, die den Seitenspiegel um 6mm nach rechts verschiebt. geometry package überschreibt diesen Wert
]{scrreprt}

\usepackage[pdftex,dvipsnames]{xcolor}          % einfache Verwendung von Farben in nahezu allen Farbmodellen
\usepackage{pgfplots}           % Zum erstellen von mathematischen Diagrammen, wie Balken, Flächen usw. 
\usetikzlibrary{chains,positioning,shapes.symbols}
\definecolor{blueaccent}{RGB}{0,150,214}
\usepackage[a4paper, left=2.5cm, right=3cm, top=2.5cm, bottom=2.5cm, bindingoffset=6mm]{geometry}
\begin{document}
\begin{figure}[h]
\centering
    \begin{tikzpicture}
      \tikzset{
        arrow/.style={
          draw,
          minimum height=2cm,
          shape=signal,
          signal from=west,
          signal to=east,
          signal pointer angle=110,
        }
      }
      \begin{scope}[start chain=transition going right,node distance=0, draw=blueaccent, distance=\linewidth]
        \node[arrow,on chain] {Auswahl};
        \node[arrow,on chain] {Exploration};
        \node[arrow,on chain] {Stichprobenziehung};
        \node[arrow,on chain] {Vorverarbeitung};
        \node[arrow,on chain] {Transformation};
        \node[arrow,on chain] {Wissensgewinnnung};
      \end{scope}
    \end{tikzpicture}
    \caption{Data Mining Prozess}
    \label{fig:DataMiningProzess}
\end{figure}
\end{document}
2
  • Can you give as a full MWE we can work on? A TikZ picture that is wider than a \linewidth will not break automatically (for TeX it is just one box). TikZ won't break a chain neither. How would you like the diagram to look? Even without the shape=signal it is propably too wide. Maybe take a look at the smartdiagram package. Jun 4, 2015 at 21:09
  • I want the whole thing to be \linewidth. And if the text cant fit into one line then it should break. Like in microsoft office when you resize a shape too small. The optimal diagram would be where the text is the same font and fontsize as my document. the text inside should look as good as possible and the width should be adjustable as I like. Obviously, if I enter stupid numbers it will look stupid (like make the width 0.1 cm and expecting the text to be still inside with fontsize 12...)
    – sceiler
    Jun 4, 2015 at 21:57

1 Answer 1

4

I’d use single TikZpictures for this. Then TeX can break them automatically.

The macro \hspace is used the pull the next entry closer as long as it is not the first entry on a line.

The tight prozess style uses the value stored in minimum height to calculate a horizontal space that is negatively inserted at the end of the node so that the right part moves closer to the text. The .75 factor is just eye-balled so that it looks nice enough. We could also use similar mathematics to calculate the horziontal space needed to pull the entries closer but measuring via calc is much easier.

enter image description here

Code

\documentclass[fontsize=12pt,a4paper,oneside,DIV12,BCOR=0mm]{scrreprt}
\usepackage[pdftex,dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.symbols,calc}
\definecolor{blueaccent}{RGB}{0,150,214}
\usepackage[a4paper, left=2.5cm, right=3cm, top=2.5cm, bottom=2.5cm, bindingoffset=6mm, showframe]{geometry}
\newcommand*\prozess[2][]{%
  \foreach\proz[count=\prozI] in {#2}{%
    \ifnum\prozI>1\relax\hspace{-\throwaway}\fi
    \tikz[prozess picture,#1]\node[anchor=base, prozess/.try]{\proz};}}
\tikzset{
  prozess/.style={
    draw=blueaccent, minimum height=2cm, shape=signal,
    signal from=west, signal to=east, signal pointer angle=110,
    text depth=+.3\baselineskip, text height=+.7\baselineskip},
  prozess picture/.append style={
    baseline, nodes={append after command={
      let \p@=($(\tikzlastnode.east)-(\tikzlastnode.north east)$) in
      \pgfextra{\xdef\throwaway{\x@}}}}},
  tight prozess/.style={
    prozess/.append style={
      execute at end node=\pgfmathparse{.75*
        (\pgfkeysvalueof{/pgf/minimum height})/2
        /tan((\pgfkeysvalueof{/pgf/signal pointer angle})/2)
      }\hspace{-\pgfmathresult pt}}}}
\begin{document}
\begin{figure}[h]
\raggedright
\prozess{Auswahl, Exploration, Stichprobenziehung, Vorverarbeitung, Transformation, Wissensgewinnung}
\caption{Data-Mining-Prozess}
\end{figure}
\begin{figure}[h]
\raggedright
\prozess[tight prozess]{Auswahl, Exploration, Stichprobenziehung, Vorverarbeitung, Transformation, Wissensgewinnung}
\caption{Data-Mining-Prozess}
\end{figure}
\begin{figure}[h]
\centering
\prozess[tight prozess]{Auswahl, Exploration, Stichprobenziehung, Vorverarbeitung, Transformation, Wissensgewinnung}
\caption{Data-Mining-Prozess}
\end{figure}
\end{document}
1
  • great I can live with that. works perfectly. Just one thing. Would it be possible to leave the chart on one line, have all chevrons the same size and only break the text inside if necessary?
    – sceiler
    Jun 5, 2015 at 11:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .