Picon
Picon

Re: Help for creating a timeline

Thanks for your quick replay and sorry for being so unspecific.

Kjell Magne Fauske schrieb:
  > Decorations are probably perfect for the zigzagged lines.

I thought so two, but I dont really know how to achieve the final result.

 > I have some problems understanding exactly what you want. Do you have
 > a link to an existing image/illustration that shows the concept?

I have tried (really hard) to create a picture. You can find it here:
http://picasaweb.google.com/Matthias.Steinbrink/Uploads
(sorry for the poor try :-), thats why I thought doing it with tikz)

Matthias

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Hans Meine | 4 Apr 10:38
Picon

Re: Help for creating a timeline

Am Donnerstag, 03. April 2008 21:08:38 schrieb Matthias Steinbrink:
>  > I have some problems understanding exactly what you want. Do you have
>  > a link to an existing image/illustration that shows the concept?
>
> I have tried (really hard) to create a picture. You can find it here:
> http://picasaweb.google.com/Matthias.Steinbrink/Uploads
> (sorry for the poor try :-), thats why I thought doing it with tikz)

I took the opportunity to try out the new decorations, but I had problems 
creating clean code (Kjell? ;-) ).  I defined two new commands to separate 
the complex drawing stuff from the data, but maybe there's a more TikZ'ish 
way?!  (All right, one *could* define new node shapes, but probably there's 
something in between, right?)

\newcommand{\tlleft}[3]{
  \fill[#3] decorate[decoration={zigzag,segment length=4pt,amplitude=1pt}]
    {(8,0) -- (8,1.5em)} -- (#1,1.5em) -- (#1,0) -- cycle;
  \path (8,0) -- node {#2} (#1,1.5em);
}

\newcommand{\tlright}[3]{
  \fill[#3]
    decorate[decoration={zigzag,segment length=4pt,amplitude=1pt}]
    {(20,1.5em) -- (20,0)} -- (#1,0) -- (#1,1.5em) -- cycle;
  \path (20,0) -- node {#2} (#1,1.5em);
}

\begin{tikzpicture}
  % draw timeline:
  \draw[->] (8,0) -- (20,0);
(Continue reading)

Picon
Picon

Re: Help for creating a timeline

First of all, thank you Hans, for your help, it made me think about my
problem and come up with a solution [1].

Hans Meine schrieb:
> I took the opportunity to try out the new decorations, but I had 
> problems creating clean code (Kjell? ;-) ).  I defined two new 
> commands to separate the complex drawing stuff from the data, but 
> maybe there's a more TikZ'ish way?!  (All right, one *could* define 
> new node shapes, but probably there's something in between, right?)

I don't know if you meant that with your problem, but your code pushes
the diagramm of the right edge of the paper (see on page 2 in my
example). I have redefined the circle direction of the rectangles and
now it works. Whether it is good code or not, I dont know ;-)

Matthias

[1]
\documentclass{article}
\usepackage[ansinew]{inputenc}
\usepackage{tikz,ifthen}
\usetikzlibrary{decorations.pathmorphing}

\newcommand{\tlleft}[3]{%
   \fill[#3] decorate[decoration={zigzag,%
    segment length=4pt,amplitude=1pt}]
     {(8,0) -- (8,1.5em)} -- (#1,1.5em) -- (#1,0) -- cycle;
   \path (8,0) -- node {#2} (#1,1.5em);
}

(Continue reading)

Kjell Magne Fauske | 4 Apr 19:00
Picon

Re: Help for creating a timeline

On Fri, Apr 4, 2008 at 6:09 PM, Matthias Steinbrink <M.Steinbrink <at> gmx.de> wrote:
> First of all, thank you Hans, for your help, it made me think about my
>  problem and come up with a solution [1].
>

The final solution looks really nice!

>  Hans Meine schrieb:
>
> > I took the opportunity to try out the new decorations, but I had
>  > problems creating clean code (Kjell? ;-) ).

My approach to clean TikZ code is to limit lines to 79 chars and to
indent the code the same way as I do when writing Python programs.

- Kjell Magne Fauske

>  > commands to separate the complex drawing stuff from the data, but
>  > maybe there's a more TikZ'ish way?!  (All right, one *could* define
>  > new node shapes, but probably there's something in between, right?)
>

>  I don't know if you meant that with your problem, but your code pushes
>  the diagramm of the right edge of the paper (see on page 2 in my
>  example). I have redefined the circle direction of the rectangles and
>  now it works. Whether it is good code or not, I dont know ;-)
>
>  Matthias
>
>  [1]
(Continue reading)

Hans Meine | 4 Apr 21:21
Picon

Re: Help for creating a timeline

On Freitag 04 April 2008, Kjell Magne Fauske wrote:
> >  Hans Meine schrieb:
> > > I took the opportunity to try out the new decorations, but I had
> > > problems creating clean code (Kjell? ;-) ).
>
> My approach to clean TikZ code is to limit lines to 79 chars and to
> indent the code the same way as I do when writing Python programs.

Sure, that is clear, I was thinking more about your use of TikZ features like 
style definitions, scopes etc., from which I learned a lot.  What I was not 
happy with was my use of \newcommand, especially with 3 arguments.  For 
example, I would have preferred a 2-argument version with the possibility to 
pass tikz options, e.g.
  \tlleft[fill=red!25]{12}{low};
or even better:
  \timeline[zigzagged=left,fill=red!25]{12}{low};

Of course, a timeline library with corresponding path commands would be the 
ideal solution.. ;-p

Wish you a nice weekend,
  Hans
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
(Continue reading)


Gmane