[Tex/LaTex] How to change the arrow orientation in Smart Diagram

smartdiagram

I am able to create a diagram with Smart Diagram using the code

\begin{figure}[htp]
\centering
\smartdiagram[priority descriptive diagram]{%
text1\\text1,
text2\\text2,
text3\\text3,
text4\\text4
}
\end{figure}

My question are:

  1. how is possibile change the arrow orientation?
  2. how can I add a text box under the arrow?

Best Answer

Here is a quick fix using an auxiliary command:

\documentclass[border=10pt]{standalone}
\usepackage{smartdiagram}

\makeatletter
\NewDocumentCommand{\smartdiagramx}{r[] m}{%
    \StrCut{#1}{:}\diagramtype\option
    \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram
        \pgfmathparse{subtract(\sm@core@priorityarrowwidth,\sm@core@priorityarrowheadextend)}
        \pgfmathsetmacro\sm@core@priorityticksize{\pgfmathresult/2}
        \pgfmathsetmacro\arrowtickxshift{(\sm@core@priorityarrowwidth-\sm@core@priorityticksize)/2}
        \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
        \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
        \foreach \smitem [count=\xi] in {#2}{%
            \edef\col{\@nameuse{color@\xi}}
            \node[description,drop shadow](module\xi)
            at (0,0+\xi*\sm@core@descriptiveitemsysep) {\smitem};
            \draw[line width=\sm@core@prioritytick,\col]
            ([xshift=-\arrowtickxshift pt]module\xi.base west)--
            ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\sm@core@priorityticksize pt,0)$);
        }%
        \coordinate (A) at (module1);
        \coordinate (B) at (module\maxsmitem);
        \CalcHeight(A,B){heightmodules}
        \pgfmathadd{\heightmodules}{\sm@core@priorityarrowheightadvance}
        \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
        \pgfmathsetmacro\arrowxshift{\sm@core@priorityarrowwidth/2}
        \begin{pgfonlayer}{background}
        \node[priority arrow,rotate=180,transform shape] at ([xshift=-\arrowxshift pt]module\maxsmitem.north west){};
        \end{pgfonlayer}
        \end{tikzpicture}
    }{}% end-priority descriptive diagram
}%

\makeatother

\begin{document}
\smartdiagramx[priority descriptive diagram]{%
    text1\\text1,
    text2\\text2,
    text3\\text3,
    text4\\text4
}
\end{document}

The result:

enter image description here

Another version with text at the bottom and top-down fading:

\documentclass[border=10pt]{standalone}
\usepackage{smartdiagram}

\tikzfading[name=priorityarrowfadingdown,
top color=transparent!5,
bottom color=transparent!80
]

\tikzset{priority
arrow fill/.style={
  fill=gray,
  path fading=priorityarrowfadingdown
  }
}

\makeatletter
\NewDocumentCommand{\smartdiagramx}{r[] m m}{%
    \StrCut{#1}{:}\diagramtype\option
    \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram
        \pgfmathparse{subtract(\sm@core@priorityarrowwidth,\sm@core@priorityarrowheadextend)}
        \pgfmathsetmacro\sm@core@priorityticksize{\pgfmathresult/2}
        \pgfmathsetmacro\arrowtickxshift{(\sm@core@priorityarrowwidth-\sm@core@priorityticksize)/2}
        \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
        \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
        \foreach \smitem [count=\xi] in {#2}{%
            \edef\col{\@nameuse{color@\xi}}
            \node[description,drop shadow](module\xi)
            at (0,0+\xi*\sm@core@descriptiveitemsysep) {\smitem};
            \draw[line width=\sm@core@prioritytick,\col]
            ([xshift=-\arrowtickxshift pt]module\xi.base west)--
            ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\sm@core@priorityticksize pt,0)$);
        }%
        \coordinate (A) at (module1);
        \coordinate (B) at (module\maxsmitem);
        \CalcHeight(A,B){heightmodules}
        \pgfmathadd{\heightmodules}{\sm@core@priorityarrowheightadvance}
        \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
        \pgfmathsetmacro\arrowxshift{\sm@core@priorityarrowwidth/2}
        \begin{pgfonlayer}{background}
        \node[priority arrow,rotate=180,transform shape] (pr-arrow) at ([xshift=-\arrowxshift pt]module\maxsmitem.north west){};
        \end{pgfonlayer}
        \node[below] at (pr-arrow.tip){#3};
        \end{tikzpicture}
    }{}% end-priority descriptive diagram
}%

\makeatother

\begin{document}
\smartdiagramx[priority descriptive diagram]{%
    text1\\text1,
    text2\\text2,
    text3\\text3,
    text4\\text4
}{Text}
\end{document}

The result:

enter image description here