Help:EasyTimeline syntax: Difference between revisions

Content deleted Content added
Parameters vs data items: comments do not complete blocks, so the comment character # is an exception to the "non-space" rule
 
(5 intermediate revisions by 3 users not shown)
Line 1:
{{Accessibility dispute|reason=Text is way too small and distorted to be legible at default size}}{{Wikipedia how-to|H:ET}}
The [[Wikipedia:EasyTimeline|EasyTimeline]] feature produces an embedded [[Help:Images and other uploaded files|image]] from wikitext. The image can be a one-dimensional diagram (horizontally or vertically), or a two-dimensional one. The name "EasyTimeline" refers to the possibility to apply the feature with a time scale horizontally or vertically, possibly with another parameter in the other direction, but there are also various other possibilities.
 
Line 96:
'''Data blocks:''' some commands, like [[#BarData|BarData]], [[#PlotData|PlotData]], [[#TextData|TextData]], [[#Colors|Colors]] expect a ''data block'' consisting of one or more ''data lines''. Data lines should start with one or more spaces. A data block is considered complete when a line
starting with a non-space is encountered, unless that non-space is the comment character #.
Thus, sinceSince empty lines are ignored, they may be used to group related data lines within a block.
 
Attributes in a data block can conceptually be divided into ''parameters'' and ''data items''. Data blocks can contain parameters and data items intermingled.
Line 478:
 
You can draw lines in any direction. The following options are available:
*'''Perpendicular to the time axis''' with arbitrary start and stop points: <code>'''at''':''date'' '''frompos''':''position'' '''tillpos''':''position''</code>
*'''Parallel to the time axis''' with arbitrary start and stop points <code>'''from''':''date'' '''till''':''date'' '''atpos''':''position''</code>
*'''In any direction''' with arbitrary start and stop points: <code>'''points''':(x1,y1)(x2,y2)</code>
 
Attributes '''at''', '''from''' and '''till''' expect a date or year, in compliance with the specified [[#DateFormat|DateFormat]].<br />
Line 516:
points:(100,20)(170,105) color:blue width:3
</timeline>
<syntaxhighlight lang="perlunixconfig" line style="font-size:90%">
LineData =
layer:front # all lines in front of bars unless stated otherwise
Line 794:
:Currently only format yyyy (default) is supported. More formats may follow.
;orientation (O) : Specify hor[izontal] (default) or ver[tical].
;order (O) : specify ''reverse'' as the option to reverse the time flow
<small>Example:</small>
<pre>
Line 1,021 ⟶ 1,020:
 
== Font support ==
Timeline has somewhat limited Unicode support. It uses FreeSans.ttf font, which supports a subset of all the possible glyphs (it supports [[Cyrillic alphabet]], east-Europe diactrics and kana for instance, but lacks [[kanji]]). You can also specify {{para|font|freesanswmf}} or {{para|font|unifont}} to specify a different font, or do the rendering in a completely different way with {{para|method|svg2png}}.
 
<small>Example:</small>
<syntaxhighlight lang="perltf">
ImageSize = width:180 height:90
PlotArea = width:180 height:90 left:0 bottom:0
Line 1,101 ⟶ 1,100:
TextData =
pos:(10,10) fontsize:XL text:"a"
}}
 
 
Example a political timeline
<pre>
{{#tag:timeline|
ImageSize = width:1010 height:auto barincrement:25
PlotArea = top:30 bottom:90 right:130 left:3
AlignBars = late
 
Define $today = {{#time:d/m/Y}}
 
DateFormat = dd/mm/yyyy
Period = from:01/01/1865 till:31/12/{{#time:Y|+1 year}}
TimeAxis = orientation:horizontal
 
Colors =
id:Liberal value:rgb(0.92,0.43,0.42) legend: Liberal_Party_of_Canada
id:OldConservative value:rgb(0.6,0.6,1) legend: Conservative_Party_→_Progressive_Conservative_Party
id:Conservative value:rgb(0.39,0.58,0.93) legend: Conservative_Party_of_Canada
id:gray1 value:gray(0.8)
id:gray2 value:gray(0.9)
id:grid value:gray(0.5)
 
ScaleMajor = gridcolor:gray1 unit:year increment:10 start:1870
ScaleMinor = gridcolor:gray2 unit:year increment:2 start:1868
 
Legend = columns:1 left:150 top:60 columnwidth:230
 
TextData =
pos:(20,65) textcolor:black fontsize:M
text:"Political parties:"
 
BarData =
bar:Macdonald
bar:Mackenzie
bar:Abbott
bar:JSDT
bar:Bowell
bar:Tupper
bar:Laurier
bar:Borden
bar:Meighen
bar:WLMK
bar:Bennett
bar:St.Laurent
bar:Diefenbaker
bar:Pearson
bar:PTrudeau
bar:Clark
bar:Turner
bar:Mulroney
bar:Campbell
bar:Chretien
bar:Martin
bar:Harper
bar:JTrudeau
bar:Carney
 
PlotData=
width:7 align:left fontsize:S shift:(5,-4) anchor:till
bar:Macdonald
from: 01/07/1867 till: 05/11/1873 color:OldConservative
from: 17/10/1878 till: 06/06/1891 color:OldConservative text:"[[John A. Macdonald]]" fontsize:10
bar:Mackenzie
from: 07/11/1873 till: 08/10/1878 color:Liberal text:"[[Alexander Mackenzie (politician)|Alexander Mackenzie]]" fontsize:10
bar:Abbott
from: 16/06/1891 till: 24/11/1892 color:OldConservative text:"[[John Abbott]]" fontsize:10
bar:JSDT
from: 05/12/1892 till: 12/12/1894 color:OldConservative text:"[[John Sparrow David Thompson]]" fontsize:10
bar:Bowell
from: 21/12/1894 till: 27/04/1896 color:OldConservative text:"[[Mackenzie Bowell]]" fontsize:10
bar:Tupper
from: 01/05/1896 till: 08/07/1896 color:OldConservative text:"[[Charles Tupper]]" fontsize:10
bar:Laurier
from: 11/07/1896 till: 06/10/1911 color:Liberal text:"[[Wilfrid Laurier]]" fontsize:10
bar:Borden
from: 10/10/1911 till: 10/07/1920 color:OldConservative text:"[[Robert Borden]]" fontsize:10
bar:Meighen
from: 10/07/1920 till: 29/12/1921 color:OldConservative
from: 28/06/1926 till: 29/06/1926 color:OldConservative text:"[[Arthur Meighen]]" fontsize:10
bar:WLMK
from: 29/12/1921 till: 28/06/1926 color:Liberal
from: 25/09/1926 till: 07/08/1930 color:Liberal
from: 23/10/1935 till: 15/11/1948 color:Liberal text:"[[William Lyon Mackenzie King]]" fontsize:10
bar:Bennett
from: 07/08/1930 till: 23/10/1935 color:OldConservative text:"[[R. B. Bennett]]" fontsize:10
bar:St.Laurent
from: 15/11/1948 till: 21/06/1957 color:Liberal text:"[[Louis St. Laurent]]" fontsize:10
bar:Diefenbaker
from: 21/06/1957 till: 22/04/1963 color:OldConservative text:"[[John Diefenbaker]]" fontsize:10
bar:Pearson
from: 22/04/1963 till: 20/04/1968 color:Liberal text:"[[Lester B. Pearson]]" fontsize:10
bar:PTrudeau
from: 20/04/1968 till: 04/06/1979 color:Liberal
from: 03/03/1980 till: 30/06/1984 color:Liberal text:"[[Pierre Trudeau]]" fontsize:10
bar:Clark
from: 04/06/1979 till: 03/03/1980 color:OldConservative text:"[[Joe Clark]]" fontsize:10
bar:Turner
from: 30/06/1984 till: 17/09/1984 color:Liberal text:"[[John Turner]]" fontsize:10
bar:Mulroney
from: 17/09/1984 till: 25/06/1993 color:OldConservative text:"[[Brian Mulroney]]" fontsize:10
bar:Campbell
from: 25/06/1993 till: 04/11/1993 color:OldConservative text:"[[Kim Campbell]]" fontsize:10
bar:Chretien
from: 04/11/1993 till: 12/12/2003 color:Liberal text:"[[Jean Chrétien]]" fontsize:10
bar:Martin
from: 12/12/2003 till: 06/02/2006 color:Liberal text:"[[Paul Martin]]" fontsize:10
bar:Harper
from: 06/02/2006 till: 04/11/2015 color:Conservative text:"[[Stephen Harper]]" fontsize:10
bar:JTrudeau
from: 04/11/2015 till: 14/03/2025 color:Liberal text:"[[Justin Trudeau]]" fontsize:10
bar:Carney
from: 14/03/2025 till: $today color:Liberal text:"[[Mark Carney]]" fontsize:10
}}
</pre>
 
renders as
{{#tag:timeline|
ImageSize = width:1010 height:auto barincrement:25
PlotArea = top:30 bottom:90 right:130 left:3
AlignBars = late
 
Define $today = {{#time:d/m/Y}}
 
DateFormat = dd/mm/yyyy
Period = from:01/01/1865 till:31/12/{{#time:Y|+1 year}}
TimeAxis = orientation:horizontal
 
Colors =
id:Liberal value:rgb(0.92,0.43,0.42) legend: Liberal_Party_of_Canada
id:OldConservative value:rgb(0.6,0.6,1) legend: Conservative_Party_→_Progressive_Conservative_Party
id:Conservative value:rgb(0.39,0.58,0.93) legend: Conservative_Party_of_Canada
id:gray1 value:gray(0.8)
id:gray2 value:gray(0.9)
id:grid value:gray(0.5)
 
ScaleMajor = gridcolor:gray1 unit:year increment:10 start:1870
ScaleMinor = gridcolor:gray2 unit:year increment:2 start:1868
 
Legend = columns:1 left:150 top:60 columnwidth:230
 
TextData =
pos:(20,65) textcolor:black fontsize:M
text:"Political parties:"
 
BarData =
bar:Macdonald
bar:Mackenzie
bar:Abbott
bar:JSDT
bar:Bowell
bar:Tupper
bar:Laurier
bar:Borden
bar:Meighen
bar:WLMK
bar:Bennett
bar:St.Laurent
bar:Diefenbaker
bar:Pearson
bar:PTrudeau
bar:Clark
bar:Turner
bar:Mulroney
bar:Campbell
bar:Chretien
bar:Martin
bar:Harper
bar:JTrudeau
bar:Carney
 
PlotData=
width:7 align:left fontsize:S shift:(5,-4) anchor:till
bar:Macdonald
from: 01/07/1867 till: 05/11/1873 color:OldConservative
from: 17/10/1878 till: 06/06/1891 color:OldConservative text:"[[John A. Macdonald]]" fontsize:10
bar:Mackenzie
from: 07/11/1873 till: 08/10/1878 color:Liberal text:"[[Alexander Mackenzie (politician)|Alexander Mackenzie]]" fontsize:10
bar:Abbott
from: 16/06/1891 till: 24/11/1892 color:OldConservative text:"[[John Abbott]]" fontsize:10
bar:JSDT
from: 05/12/1892 till: 12/12/1894 color:OldConservative text:"[[John Sparrow David Thompson]]" fontsize:10
bar:Bowell
from: 21/12/1894 till: 27/04/1896 color:OldConservative text:"[[Mackenzie Bowell]]" fontsize:10
bar:Tupper
from: 01/05/1896 till: 08/07/1896 color:OldConservative text:"[[Charles Tupper]]" fontsize:10
bar:Laurier
from: 11/07/1896 till: 06/10/1911 color:Liberal text:"[[Wilfrid Laurier]]" fontsize:10
bar:Borden
from: 10/10/1911 till: 10/07/1920 color:OldConservative text:"[[Robert Borden]]" fontsize:10
bar:Meighen
from: 10/07/1920 till: 29/12/1921 color:OldConservative
from: 28/06/1926 till: 29/06/1926 color:OldConservative text:"[[Arthur Meighen]]" fontsize:10
bar:WLMK
from: 29/12/1921 till: 28/06/1926 color:Liberal
from: 25/09/1926 till: 07/08/1930 color:Liberal
from: 23/10/1935 till: 15/11/1948 color:Liberal text:"[[William Lyon Mackenzie King]]" fontsize:10
bar:Bennett
from: 07/08/1930 till: 23/10/1935 color:OldConservative text:"[[R. B. Bennett]]" fontsize:10
bar:St.Laurent
from: 15/11/1948 till: 21/06/1957 color:Liberal text:"[[Louis St. Laurent]]" fontsize:10
bar:Diefenbaker
from: 21/06/1957 till: 22/04/1963 color:OldConservative text:"[[John Diefenbaker]]" fontsize:10
bar:Pearson
from: 22/04/1963 till: 20/04/1968 color:Liberal text:"[[Lester B. Pearson]]" fontsize:10
bar:PTrudeau
from: 20/04/1968 till: 04/06/1979 color:Liberal
from: 03/03/1980 till: 30/06/1984 color:Liberal text:"[[Pierre Trudeau]]" fontsize:10
bar:Clark
from: 04/06/1979 till: 03/03/1980 color:OldConservative text:"[[Joe Clark]]" fontsize:10
bar:Turner
from: 30/06/1984 till: 17/09/1984 color:Liberal text:"[[John Turner]]" fontsize:10
bar:Mulroney
from: 17/09/1984 till: 25/06/1993 color:OldConservative text:"[[Brian Mulroney]]" fontsize:10
bar:Campbell
from: 25/06/1993 till: 04/11/1993 color:OldConservative text:"[[Kim Campbell]]" fontsize:10
bar:Chretien
from: 04/11/1993 till: 12/12/2003 color:Liberal text:"[[Jean Chrétien]]" fontsize:10
bar:Martin
from: 12/12/2003 till: 06/02/2006 color:Liberal text:"[[Paul Martin]]" fontsize:10
bar:Harper
from: 06/02/2006 till: 04/11/2015 color:Conservative text:"[[Stephen Harper]]" fontsize:10
bar:JTrudeau
from: 04/11/2015 till: 14/03/2025 color:Liberal text:"[[Justin Trudeau]]" fontsize:10
bar:Carney
from: 14/03/2025 till: $today color:Liberal text:"[[Mark Carney]]" fontsize:10
}}