Building on the nice answer to this question, I would like to modify the boxes right to the timeline to show a label (instead of the year) that I would like to specify right after the text of each entry, maybe in another {...}. Is this possible? I've seen the chains manual, but this one seems to require quite a bit more knowledge.
\documentclass[tikz]{standalone}
\usetikzlibrary{chains}
\makeatletter
\tikzset{west below/.code=\tikz@lib@place@handle@{#1}{north west}{0}{-1}{south west}{1}}
\makeatother
\tikzset{
typnode/.style={anchor=north west, text width=12cm, inner sep=0mm},
data/.style={draw=gray, rectangle, font=\scriptsize, inner sep=0.5mm},
}
\begin{document}
\begin{tikzpicture}[x=1cm, y=-7mm]{
%draw horizontal line
\foreach \xValue in {0,5}
\path (\xValue,0) edge[-latex] ++(0,6.5)
edge[dashed] ++ (down:1);
%%draw years
\foreach \year in {1995,2000}{
\node[left=2pt,anchor=east,xshift=0,font=\scriptsize] at (0,\year - 1995) {$\year$};
}
\foreach \year in {1995,1996,...,2000}{
\draw (-0.1,\year-1995) -- (0.1,\year-1995); \draw (0,\year-1995+.5) -- (0.1,\year-1995+.5);
}
\begin{scope}[start chain=ch1 going west below, node distance=+1em]
\foreach \Year/\Text in {%
1995/{King James VI of Scotland ascends to the English throne, becoming James I of England and uniting the crowns - but not the parliaments - of the two kingdoms},
1995.01/{King James VI of Scotland ascends to the English throne, becoming James I of England and uniting the crowns - but not the parliaments - of the two kingdoms}
}{
\node[typnode, at=(right:3cm), on chain=ch1, alias=Text] {\Text};
\node[data, base left=+2em of Text, alias=Year] {\Year};
\draw (Year.west) -- ++(left:3mm)
-- ([shift=(right:3mm)] 0,{(\Year-1995)/10})
-- (0,{(\Year-1995)/10});
}
\end{scope}
}
\end{tikzpicture}
\end{document}
There is also a second vertical line crossing the text that I haven't figured out to remove and when I try to include it in a documentclass[article], I get 1.5 empty pages upfront for a reason I don't understand, but these are secondary questions.
34
, I don't know why OP had that in his original code. Just remove the5
and/or replace the loop and substitute0
for\xValue
. The 1.5 empty pages I can't reproduce. You can just do\node[ base right=of Year] {\Label};
. You just need to include the\Label
like\Year
and\Text
in the\foreach
loop.right=of Text
not Year.