timeline - Program to draw an SVG timeline diagram from events defined in a file
$ timeline list_of_events.txt > timeline.svg
A program to produce SVG timeline diagrams from events defined in a file.
This program reads data from a file given on the command line and writes an SVG document to STDOUT.
STDOUT
The program reads input data from a tab-separated file. Each line in the file represents a single event in the timeline - which will be represented by a coloured rectangle in the diagram.
Each line in the file requires three columns of data: a text string (to be used as the label for the event), a start year and an end year. There can also be an optional fourth column which is a colour for the background of the rectangle representing the event. This colour can be a colour name (e.g. red) or an RGB string as recognised by SVG (e.g. rgb(255,0,0)).
red
rgb(255,0,0)
An example input file might be:
World War I 1914 1918 World War II 1939 1945
Or, with colours included:
World War I 1914 1918 red World War II 1939 1940 blue
The program takes three command line options. This are all options.
The number of years between grid lines in the output. The default value is ten, which gives a line every decade.
This will be inserted as the width attribute of the top-level SVG element in the output. The default is 100%.
width
100%
This will be inserted as the height attribute of the top-level SVG element in the output. The default is 100%.
height
Dave Cross <dave@perlhacks.com>
Copyright (c) 2017, Magnum Solutions Ltd. All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install SVG::Timeline, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SVG::Timeline
CPAN shell
perl -MCPAN -e shell install SVG::Timeline
For more information on module installation, please visit the detailed CPAN module installation guide.