Template:Graphical timeline

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Template documentation[view] [edit] [history] [purge]

The easy way[change source]

Type {{include timeline}} in your article, press preview, and follow the link made. You will be presented with a ready-to-go template; once this is finished, return to your article, and { {include timeline} } will display your timeline.

Template function[change source]

This template provides an intuitive, user-friendly and flexible way to insert timelines into articles. It is designed to require the lowest number of variables, and to reside within a table - although a margin can be added.

Why use this template?[change source]

The alternative to this template is m:EasyTimeline, using the <template> syntax. EasyTimeline has the following weaknesses:

  • Pixelated image made, which looks different and increases page load time
  • Long set-up time - taking 30 minutes plus even when you know what you are doing
  • Impenetrable code requiring precise syntax
  • Difficult to place bars exactly where you want them
  • Changing minimum dates and sizes requires modification in many places
  • Everything must be decided - nothing is automatic
  • It is not scalable - it does not enlarge with text size.

Using the template[change source]

Where to use it[change source]

Whilst short timelines can be inserted directly into the article, some changers complain that long, hard timelines break up the flow of the page and make changing hard. Therefore, you may want to use {{Include timeline}} to host the timeline code on another page, which will be automatically included.

Getting started[change source]

You can set the switch |help=on in the template to produce some quick pointers.
When you are getting started, you might want to use {{Graphical timeline|help=on}} to generate a ready-made, empty template - or type {{subst:Graphical timeline/blank}} into a sandbox page, save the page, and edit the resulting code. Hopefully, the parameter names are pretty self-explanatory.

What numbers mean[change source]

Numeric values are by default in units of em, that is, the height and width of a capital M.

The exception to this is the left and right parameters of a bar, which are set using fractional coordinates. That is to say, the code |bar1-left=0 |bar1-right=0.5 |bar2-left=0.666 |bar3-left=0.5 |bar3-right=0.666 will produce bar1 covering the left half of the area, bar2 covering the right-most third, and bar3 in between them. Further, for operational reasons, the height-units are always used to produce border widths.

Bar borders[change source]

Borders appear only on the top and bottom of any given bar. Unfortunately, this cannot be changed - to have a border at the top or bottom only of a bar, you should create a separate bar to overlay the end.

Border style can be set to the CSS standards of solid, dotted, dashed, double, groove, ridge, inset or outset. Width is in the same units as height, and if none is decided 0.1 to 0.2 is a appropriate hairline value.

Blank lines[change source]

Leaving a parameter blank is NOT the same as not deciding it - it will override the template's default value. Be sure to remove any lines you do not decide.

Geological periods[change source]

To draw a geological period, use the syntax |period3=Triassic, with |period3-left=0.1 as usual. The template will then calculate the beginning, end and correct colour of the bar.

Considerations[change source]

Browsers[change source]

Unfortunately, different browsers have different ways of dealing with lines of text that overflow their container - some stretch the container whilst others wrap the text. This means it's probably worth checking your finished timeline in at least IE and Firefox if you are making a particularly complex timeline.

Colours[change source]

If you are setting colors using html values that look like #e0b539, do consider that some older monitors, and many projectors, cannot display some colors. Sticking to Web-safe colours ensures highest compatibility, which is often appreciated; i.e. multiples of 33, e.g. #ff99cc or #03C.

Capacity[change source]

If you find that highly-numbered bars, notes or legend entries are not showing up, it could be because the template has not been coded to handle it. There are instructions in the template code for how to add capacity for more bars etc.

Easy editing[change source]

If you create a timeline on a subpage, do use the | link-to= parameter. Decide the page name (e.g. Template:My graphical timeline), and "edit" and "history" links will appear.

Parameter list[change source]

The list may be long, but do not be frighten - you only need to use a couple, and the rest give you limitless flexibility!

Replace any instance of # with a number.

To and from are mandatory, all other parameters are optional.

General parameters[change source]

Timeline parameters
Parameter What it does/makes Required?
from The start date of the timeline. May be negative. Yes
to The final (uppermost) date of the timeline. May be negative. Yes
width width of the timeline No
title What to display in the title bar No
title-colour The background colour for the title bar No

Geological periods[change source]

Parameter What it does/makes
period# Specify the name of the period; the template will automatically work out when it starts and ends, and colour it correctly.
Period parameters

Bars[change source]

Parameter What it does/makes
width width of the timeline
Bar parameters

Legend[change source]

Parameter What it does/makes
width width of the timeline
Legend parameters

Notes[change source]

Parameter What it does/makes
width width of the timeline
Note parameters

In use: an example[change source]

The code on the left makes the timeline on the right, which is deliberately terrible in order to demonstrate the limitations of the template.

Example Timeline
-550 —
-540 —
-530 —
-520 —
-510 —
-500 —
Base of the Cambrian
Cambrian explosion
An approximate time-scale of events
at the base of the Cambrian Period.
Axis scale is in millions of years ago.
{{Graphical timeline

|title=Example Timeline










|<!-- If this was bar 4 it would be overlapped by the Botomian bar -->
|legend14=Cambrian explosion

|<!--Epochs & stages-->
|bar5-border-colour= #996666







|note1=Base of the Cambrian

|note2=[[Middle Cambrian]]

|caption=An approximate time-scale of events<br>at the base of the [[Cambrian]] [[Period (geology){{!}}Period]].
<br>Axis scale is in millions of years ago.

Notes on the example[change source]

  • {{!}} must be used wherever you want a | to appear (e.g. the caption)
  • If you do not decide when a bar should start or end, it will go on to the edge of the plot
  • Text should not be too long for the bar
  • The way that overflowing text wraps is also handled differently in the two borders - it pokes out of the right of the bar on Firefox, but is wrapped within it by IE. Try to manually enter newlines when required rather than relying on browsers to sort it out. Or position a note over the bar - check out note2, which is nudged left over the plot background.