Extension:EasyTimeline/構文

This page is a translated version of the page Extension:EasyTimeline/syntax and the translation is 41% complete.
Outdated translations are marked like this.

EasyTimeline 機能は、ウィキテキストから埋込画像を生成します。 画像は、1次元ダイアグラム(水平/垂直)または2次元ダイアグラムとすることができます。 「EasyTimeline」という名前は、時間軸を水平方向または垂直方向にして、あるいは別方向に他のパラメータを使って機能を利用できることを意味していますが、それ以外にも様々な可能性があります。

はじめに

グラフィカル・タイムラインは、以下のように特殊タグの間にスクリプトを配置することで作成できます。

<timeline> スクリプト </timeline>

それによりEasyTimelineが呼び出され、PNG画像と(オプションで)クリック可能なマップがレンダリングされます。

免責事項: EasyTimelineは使いやすいように設計されていますが、複雑なグラフィカル・タイムラインはnon-trivial affairです。 単純なタイムラインは、作成に30分かかる場合があります(適切な例を基本とすれば、もっと早い)。 大きなタイムラインは、構成と微調整に数時間かかるかもしれません。 ただし、複雑ではあっても、タイムラインの追加や修正は、ここで記載する構文の専門知識がない寄稿者であっても、比較的簡単なことです。

質問はお気軽に執筆者宛てに御連絡ください。

利用可能なコマンド

スクリプトコマンドは下記を定義します:


全般的なコード規則

スクリプトには、コマンドとコメントを含めることができます。各コマンドには、1つ以上の属性が付きます。

大文字・小文字: コマンドと属性には、小文字、大文字、または大文字と小文字を組み合わせて記述できます。 大文字・小文字を使用する場合には一貫性を保つようにしてください。これにより、読みやすくなります。例えば、全てのコマンドは大文字・小文字の混在とし、属性はすべて小文字を使用。

下記のコマンドは必須です:

  • ImageSizeは、タイムライン全体の大きさを決めます。
  • PlotAreaは、マージンを決めます。
  • Periodは、チャートに表示される期間を決めます。
  • TimeAxisは、時間軸の方向(水平/垂直)を決めます。

次のコマンドの少なくとも1つが必要です (いずれかまたは両方が複数回出てくる場合があります):

他のすべてのコマンドは省略可能です。

コメント

1行および複数行のコメントを指定できます。:

  • ハッシュ記号#に続くテキストはコメントと見なされます
  • #><#の間のテキストもコメントと見なされます。この方法でタグ付けすると、コメントを複数行に記載できます。

例:

DateFormat = dd/mm/yyyy # European date format

Period = from:01/09/1939 till:02/09/1945 #> this chart will show
  the complete duration of World War II <#

コマンド

コマンドは、行の行頭から開始する必要があります。

一部のコマンドは、複数行のデータやオプションを後ろに続けることができます。 これらの余分な行は、少なくとも1つのスペースで始まるか、完全に空である必要があります(後者は、関連するデータ行を視覚的にグループ化するのに便利です)。

コマンドには、コマンドの種類に応じて、以下のいずれかの形式があります:

コマンド = 属性(群)

DateFormat = dd/mm/yyyy

コマンド名 = 属性(群)

Define $US = text:"United States"

コマンド =

属性(群)
属性(群)
など…
PlotData =
  fontsize:XS width:20
  bar:Japan from:start till:19/02/1945 color:JT
  bar:Japan from:19/02/1945 till:14/03/1945 color:AI

属性

コマンドに対し複数の属性が指定される場合、'name:value'のペアとして表記されます。 1つの属性に複数の値を指定できる場合は、括弧で囲む必要があります。 Colorなどのいくつかのコマンドは、他の形式を使用します。

例:

BackgroundColors = bars:darkgrey
PlotData = at:5 shift:(10, -7) text:Foo
Color SB = value:rgb(0.8,0,0.7) legend:Sea_Battles

Parameters vs data items

ほとんどのコマンドは、同じ行で指定された属性のみを受け入れます。

データ ブロック
BarData, PlotData, TextData, Colorsなどの一部のコマンドは、1つ以上のデータ行で構成されるデータブロックを想定しています。データ行は、1つ以上のスペースで始める必要があります。スペース以外で始まる行が検出されると、データブロックは完了したと見なされます (例外: 空行は無視され、ブロック内の関連するデータ行をグループ化に使用できます)
データブロック内の属性は、概念的に パラメーターデータ項目 に分けることができます。データブロックには、パラメーターとデータ項目を混在できます。
データ項目
データ行の属性text, from, till および atは、常にそれらが出てくる行にのみ適用されます。
パラメーター
データ行では、フォントサイズ などの属性は、コンテキストに応じて異なる意味を持ちます。

これらのパラメーターがデータ項目のない行で出てくる場合、後続のデータ行に新しい既定値が設定されます。 それらがデータ項目と混合された行に表示される場合、それらはその行にのみ適用されるため、以前に設定された既定値が無効になります。

例:

# In this example two sets of bars are drawn, in red and blue respectively,
# but in each set one bar (marking war periods) will be drawn in green.

PlotData =
  color:red fontsize:S                               # set defaults
  bar:USSR from:1919 till:1922 text:Lenin            # red bar
  bar:USSR from:1922 till:1953 text:Stalin           # red bar
  bar:USSR from:1939 till:1945 text:WWII color:green # green bar
  bar:USSR from:1953 till:1964 text:Krushchev        # red bar
   
  color:blue                                         # change default color
  bar:US from:1913 till:1921 text:Wilson             # blue bar
  bar:US from:1917 till:1918 text:WWI color:green    # green bar
  bar:US from:1921 till:1923 text:Harding            # blue bar

#> this multiline comment does not end command PlotData,
   even when the previous line does not start with a space<#

   bar:US from:1923 till:1929 text:Coolidge           # blue bar

TextData =                                            # now PlotData is considered complete
   tabs:...etc

Attribute data input rules

Measurements

Measurementsは、属性で指定された単位により、absoluteまたはrelativeの画像サイズとすることができます。 座標ペアをとる属性では、座標の1番目は左から右に水平で、座標の2番目が垂直に上向きです。

Absolute measures

これらは、画像の合計サイズ、位置、および位置シフトを指定するために使用できます。 値は、ピクセル(px)、インチ(in)、センチメートル(cm)の後置単位を付けて指定することができます。 値は小数点を含む数値とすることができます。

例:

PlotArea = left:50 bottom:50 right:50 top:90

以下のabsolute measuresは同じものです:

  • 800px
  • 800 (デフォルト単位はピクセルです)
  • 8in (1インチ当り100ピクセルの画面解像度を想定)
  • 3.15cm (同じ画面解像度を想定し、センチメートルに変換)

Relative measures

They may be used for specifying sizes and positions according to the total image sizes; they can't be used for specifying the total image sizes (see ImageSize) but may be used to define the PlotArea.

水平measurementsの場合、パーセンテージは画像幅に関連し、垂直measurementsの場合は画像高さに関連します。

0~100の間の数値を指定し、直後に'%(パーセント)記号を付けます。

例:

PlotArea = left:10% bottom:5% right:5% top:15%

テキスト入力

テキスト入力にはいくつかの規則があります:

  1. フォントのレンダリングにはUnicodeのサブセットのみが許可されていますが、リンク内のUnicodeはすべての文字で機能するはずです。フォントのサポートも参照してください。
  2. テキストにスペースを含める必要がある場合は、アンダースコア(_)を使用してスペースを指定するか、テキストを「二重引用符」で囲みます。
  1. Exception: when the text attribute is the last attribute on a line, spaces are allowed (no confusion will arise where the text stops and the next attribute starts, that is—to be precise—when no colons occur in the text).
  1. コマンドTextDataに続くデータ行では、次の2文字は特別な意味を持ちます:
    ^ (キャレット)はタブを意味します
    ~ (チルダ)は改行を意味します

例:(以下は全て同じ意味です)

BarData =
  text:Japanese_mandate_since_1914 bar:Marshalls

BarData =
  text:"Japanese mandate since 1914" bar:Marshalls

BarData =
  bar:Marshalls text:Japanese mandate since 1914

タブを表示する例:

TextData =
  tabs:(4-right,12-right,14-left,34-left)
  text:^1^1940^27/9^Berlin Ger,It,Jap sign Tripartite Pact
  text:^10^1944^1-22/7^Bretton Woods 44 nations establish
  text:^^^^^IMF and World Bank

# will be shown as:
#
#      1    27/9 Berlin Ger,It,Jap sign Tripartite Pact
#     10  1-22/7 Bretton Woods 44 nations establish
#                                    IMF and World Bank

クリッカブルマップ

MediaWikiで利用可能な両方の出力形式PNGとSVGには、クリック可能なリンクを含めることができます。青色で表示されたテキストとバーをクリックすると、別のWebページに移動できます。

リンクは、コマンドBarDataPlotData、およびTextDataを使用して、属性linkか、属性textを介して埋め込みリンクとして指定できます。

埋込みリンク

Embedded links are links that are (part of a) displayable text, specified with attribute text. Their counterpart are explicit links (URL only) which are defined with attribute link.

Both type of links can be specified with commands BarData, PlotData and TextData and are used for clickable maps.

In embedded links, internal link style is as usual, interwiki link style does not work, external link style is as usual with single brackets, but here with a pipe instead of a space.

例:

  text:example [[Help:Link]] internal link

次のように表示されます:

Help:Link
  text:[[Help:Link|Link]]

次のように表示されます:

Help:Link
  text:[http://en.wikipedia.org/wiki/Rembrandt|Rembrandt van Rijn] paints Night Watch

次のように表示されます:

en.wikipedia.org/..

インターウィキの使用

インターウィキリンク形式を使う場合:

  text:[[en:Main Page]]

and similar with nl: and m: gives:

m:Main Page

The third one to Meta-Wikipedia works properly, except from Meta itself, the other links work like Main Page (internal page, the prefix is ignored) or e.g. //www.mediawiki.org/w/Main_Page (gives File not found), depending on the URL of the referring page (e.g. different for a preview page and a diff page).

特殊文字

  • #, #>, <# (ハッシュ、ハッシュ>、<ハッシュ)はコメント節を参照。
  • ~ (チルダ)は、改行を意味します
  • ^ (キャレット)は、タブを意味します
  • _ (アンダースコア)は、スペースを意味します
  • $ (ドル記号)は、ユーザー定義定数の前に使われる

URL中ではスペースとアンダースコアは、%20と記述する必要があります。

チルダ文字()は通常、改行として解釈されます。チルダがURLの一部である場合は、2つのチルダで記述します。
例えばwww.site.com/~mysiteにリンクする場合:

  text:[www.site.com/~~mysite|My site]

番号記号(#)は通常、コメントの開始として解釈されます。番号記号がURLの一部である場合は、次のようにテキストが二重引用符で囲まれていることを確認してください。:

  text:"More at [www.site.com/~~mysite#section2|My site]"

実のところ、テキストは常に二重引用符で囲むことをお勧めします。

コマンド・リファレンス

各コマンドについて有効な属性が一覧表示されます。一部のコマンドは必須であり、コマンドの一部の属性はオプションです。

一部のコマンドでは、特定の属性は相互に排他的です(該当する場合は説明します)。

AlignBars

バーは常に等間隔で描画されます。このコマンドは、バーをできるだけ離して配置するか、チャートの左側/上部と最初のバーの間、または最後のバーとチャートの右側/下部の間に空白をあけるかを指定します。

early (default)
The first bar will be placed on the leftmost/topmost position of the chart ('glued' to the axis), leaving space between the last bar and right/bottom side of the chart.
late
Opposite from early: the last bar will be placed as far to the right/bottom side of the chart as possible, leaving space between the axis line (left/top side of chart) and the first bar.
justify
The first and last bars will be placed as far apart as possible, leaving no empty space on either side of the chart. When only one bar is present, justify will be interpreted as "centered".

正確な配置は、必須コマンドであるTimeAxisの方向設定に依存します。

例:

Alignbars = early late justify (default)
TimeAxis = orientation:horizontal
TimeAxis = orientation:vertical

BackgroundColors

このコマンドは、チャートの様々な部分の背景色を指定できます。指定されたcolor-idは、最初にColorsを使用して定義する必要があります。

canvas:color-id (optional)
画像全体の背景色を指定します。
bars:color-id (optional)
すべてのバーの背景色を指定します。

例:

BackgroundColors = bars:darkgrey

BackgroundColors = canvas:lightgrey bars:darkgrey

BackgroundColors = canvas:lightgrey

BarData

これはオプションのコマンドであり、これがある場合、チャートに描画されるバーおよび、その順序を決定します。 省略した場合、コマンドPlotDataに表示されてる順序でバーが描画されます。

多くのバーがある複雑なタイムラインの場合、このコマンドの使用が推奨されます。

  • 表示データのならべ替えが簡単になります。
  • PlotDataで指定されるバー名は、このリストに対して検証でき、入力ミスを防ぐことができます。
bar:bar-id (optional)
Defines the bar id. Other commands (notably PlotData) will expect this id for reference. This will also be the label to be shown along the axis, unless attribute text is present. The bar id should not contain any spaces: use underscores instead, these will be converted to spaces, as with article titles.
bar:barset-id (optional)
Specifies the barset id to be used for other commands. Like the bar id, underscores should be used as opposed to spaces.
text:some_text (optional)
When specified this specifies the text to be presented along the axis, instead of the bar id. See also rules for text input. The text may include one embedded link (see Note 1).
link:local-URL (optional)
Specify a web link (see Note 1) (URL). The label along the axis will be shown as a blue clickable link.

Notes

  1. Either use attribute link, or an embedded link in attribute text, not both.

例:

BarData =
  bar:Japan
  bar:US       text:"United States"  # refer in PlotData to bar "US" but show "United States"
  bar:China    text:[[China]]        # label China will be shown as blue clickable link to the English Wikipedia article about China

以下の行は同じ結果となります(PlotDataの変更での参照のみ):

bar:US            text:[[United_States]]

bar:US            text:"United States" link:http://www.wikipedia.org/wiki/United_States

bar:United_States                      link:http://www.wikipedia.org/wiki/United_States

Colors

This command allows colors to be defined and coupled to an id (identification tag). Other commands will refer to colors with the id specified here. This command expects one or more color definitions, each on a separate indented line.

id:color-id
Other commands will use this id to specify text, bar or background colors.
value:color-space(coordinates)
Actual color definition. Color values can be either be specified as:
  • predefined-color-name: 32 color constants are predefined and recognized (see the Ploticus color page where all these constants are defined).
  • rgb(red,green,blue): specify 3 numbers between 0 (minimal) and 1 (maximal)
  • hsb(hue,saturation,brightness): specify 3 numbers between 0 and 1.
  • gray(value): specify a number between 0 (black) and 1 (white).
Notes
  1. 0 and 1 colorspace coordinates must be specified as integers only, intermediate coordinates require a dot as the decimal separator after 0.
  1. To create RGB or HSV colors please see RGB/HSB Color converter
Hexadecimal to rgb()
To convert from hexadecimal (#D09916) to rgb (rgb(0.816,0.600,0.086)):
  1. Visit ColorHexa, and search for your hexadecimal colour.
  1. Read the line of text at the start along the lines of "In a RGB color space, hex ... is composed of RR.R% red, GG.G% green and BB.B% blue".
  1. Divide the three numbers (RR.R, GG.G and BB.B) by 100, and use the resultant number (between 0 and 1) as the values for rgb().
legend:some_text (optional)
Specifies the text that should be displayed in the legend for this color. If this attribute is omitted no entry will appear in the legend at all.
Notes:
  1. See Text Input for rules.
  1. Embedded links are supported in legend texts, see Clickable maps.

例:

Colors =
  id:war       value:red   legend:War_Period
  id:peace     value:blue  legend:Peace_Time
  id:treaty    value:rgb(0.6,0,0.6)
  id:lightgrey value:gray(0.9)
  id:darkgrey  value:gray(0.1)

事前定義されている色

HTMLでの色の参照

#000000 #b29999 #e5d3c9 #ffffff      
#ffcccc #ff9999 #ff4c7f #b24c4c #ff0000 #dc143c  
#ff7f00 #ff9e23 #ffcc99 #ffd800 #eaea00 #ffff00 #ffe599
#00ff00 #00b200 #4c994c #007f33 #99cc99 #99e599 #ccffb2
#b2ccff #007fcc #0066cc #0000ff      
#770077 #aa4caa #9999ff #b2b2ff #ccb2cc    

DateFormat

このコマンドは、他のコマンドで指定された日付の解釈方法を定義します。

有効な日付フォーマットは以下の通りです。

dd/mm/yyyy (ほとんどの英語圏の国々の日付)
日付は「日/月/年」として解釈されます。
: この形式は、1800年1月1日から始まる日付でのみ許されます。
mm/dd/yyyy (米国での日付)
日付は「月/日/年」として解釈されます
: この形式は、1800年1月1日から始まる日付でのみ許されます。
yyyy (これがデフォルトの形式です)
これは、先行ゼロなしの-9999から9999までの整数を扱います

次の形式はまだサポートされていません:

  • ISO8601標準形式: yyyy-mm-dd (カナダの標準).
  • the alternate Central-European standard format: yyyy.mm.dd.
  • 月表記(日表記はない)の日付形式: mm/yyyy または ISO 8601 yyyy-mm.
  • 四半期のある日付形式: qq/yyyy または ISO 8601 yyyy-Qq.
  • その他の日付の区切文字、多言語の省略された月の名前...

例:

DateFormat = mm/dd/yyyy

Define

このコマンドは、テキスト定数、つまり複数回出てくるスクリプトコードの省略形を定義できます。 テキスト定数は常に$(ドル記号)で始まる必要があります。

例:

Define $broad       = width:30
Define $narrow      = width:10
Define $bardefaults = $broad fontsize:S

ImageSize (mandatory)

このコマンドは、最終的な画像の全体サイズを定義します。absolute measurementsの値を指定します。

width:pixels/auto
最終画像の幅(ピクセル単位):最大は1600ピクセル、最小は25ピクセル
(TimeAxis方向が垂直に設定されている場合、autoに設定することもできます)
height:pixels/auto
最終画像の高さ: 最大は1200ピクセル、最小は25ピクセル
(TimeAxis方向が水平に設定されている場合、autoに設定することもできます).
barincrement:pixels
指定された各バーの画像サイズに追加されるピクセル数
(width:autoまたはheight:autoとの組合せでのみ可能で、その場合は必須).

For maximum flexibility you can let the script calculate the height or width of the image, based on the number of bars and the amount in pixels to add per bar. Specify height:auto (for horizontal time axis) or width:auto (for vertical time axis).

This is especially helpful when the number of bars in a timeline is likely to change over time again and again. Or to ensure equal distances between bars in images with many narrow bars where differences in amount of white space would soon be noticed (see for a real example :en:Template:Vocal and instrumental pitch ranges). Or to make sure several related timelines always use the same distance between bars, no matter how many bars each contains (see for a real example :en:List of popes (graphical). In short it is a good idea most of the time.

例:

ImageSize = width:800 height:600

ImageSize = width:800 height:auto barincrement:30

Legend

凡例は、このコマンドが存在し、少なくとも1つのcolorslegend:属性が指定されている場合にのみ表示されます。 凡例の外観と位置を定義する方法はいくつかあります。一部の属性は相互に排他的です(以下参照)。

orientation:hor/ver (オプション)
hor[izontal] または ver[tical](デフォルト)を指定します。
制限: orientation = 'horizontal' と position = 'right'は相互に排他的です。
position:top/bottom/right (オプション)
チャート領域に対する凡例の配置を定義します。top, bottom (デフォルト)または rightを指定します。
制限:orientation = 'horizontal' と position = 'right'は相互に排他的です。
columns:整数 (省略可能)
1、2、3、4のいずれかを指定します。
この属性が省略された場合、カラム数は以下のように決定されます:
  • orientation horizontal: Attribute columns does not apply here. All entries will be on the same line.
  • orientation vertical:
    • position right: All entries will be in one column
    • position top or bottom: The number of columns depends on the number of entries to be shown:
      1-5 entries: 1 column, 6-10 entries: 2 columns, 11 or more entries: 3 columns.

Tip: まずは以下のパラメータを省略してみて、デフォルト設定では不十分な場合にのみ追加することを考えてください

columnwidth:distance (optional)
Defines the distance between columns. You can specify an absolute distance or a relative distance (as percentage of the image width).
restriction: this parameter is ignored when columns = 1 is defined or implied.
left:distance (optional)
Defines the distance between the left side of the legend and the left side of the image. You can specify an absolute distance or a relative distance (as percentage of the page width).
top:distance (optional)
Defines the distance between the top of the legend and the bottom of the image. You can specify an absolute distance or a relative distance (as percentage of the page height).

例:

Legend = orientation:vertical position:bottom columns:3 columnwidth:140

Legend = orientation:horizontal position:bottom

Legend = left:100 top:120 columns:3

LineData

Some timelines extend over several clearly distinct periods. A line demarcating these periods may serve as a visual aid.

at:time
Draws a line perpendicular to the time axis (between minimum and maximal positions, see also below).
Specify the date/year where the line should be drawn, in compliance with the specified DateFormat.
color:color-id (optional)
Specify the color in which the line should drawn.
Note: The color id specified should be defined first with command Colors.
layer:front/back (optional)
Specify front or back (default). Defines whether the line should appear in front of or behind all time segment bars.
width:distance (optional)
Specify value between 0.1 (very thin) and 10 (very thick); the default value is 1

Advanced positioning options

You can draw lines in any direction. Only in rare cases the following extra attributes may be needed for full flexibility:

  1. Parallel to the time axis with arbitrary start and stop times:
  1. atpos:position
  1. from:time (optional)
  1. till:time (optional)
  1. Specify the absolute or relative position on the axis orthogonal to the TimeAxis.
  1. Specify the dates/years between which the line should be drawn, in compliance with the specified DateFormat (default is the full range of time as set in the mandatory Period command, see also below).
  1. Orthogonal to the time axis with arbitrary start and stop positions:
  1. at:time
  1. frompos:position (optional)
  1. tillpos:position (optional)
  1. Specify the date/year where the line should be drawn, in compliance with the specified DateFormat.
  1. Specify the start and stop absolute or relative positions on the axis orthogonal to the TimeAxis (default is the full length of the DrawArea).
  1. Draws a line orthogonal to the time axis (default at full range of time as set in the mandatory Period command, see also below).
  1. In any direction with arbitrary start and stop points:
  1. points:(x1,y1)(x2,y2)
  1. Specify the absolute or relative positions as coordinates, independently of the direction of the time axis.

例:

LineData =
  layer:front                                            # all lines in front of bars unless stated otherwise
  at:1                         color:yellow              # perpendicular to time axis full length
  at:2                         color:orange  layer:back  # perpendicular to time axis full length but behind bars
  at:4  frompos:50 tillpos:105 color:green               # perpendicular to time axis, with specified start and stop points
  from:5 till:8 atpos:50       color:red                 # parallel to time axis
  points:(100,20)(170,105)     color:blue    width:3     # from one arbitrary absolute position to another, extra thick

Period (mandatory)

Defines the time period that will be displayed in the chart. Both parameters are mandatory. Specify dates in compliance with specified DateFormat.

from:time
Timeline starts here. The specified value can be referenced as start in commands like PlotData and TextData.
till:time
Time ends here. The specified value can be referenced as end in other commands.

例:

Period = from:01/09/1939 till:02/09/1945

PlotArea (mandatory)

left:distance
Margin between left side of image and left side of plot area. Specify value in absolute or relative measurements.
top:distance
Margin between top of image and top of plot area. Specify value in absolute or relative measurements.
right:distance (recommended)
Margin between right side of image and right side of plot area. Specify value in absolute or relative measurements.
This attribute and the deprecated width attribute are mutually exclusive.
bottom:distance (recommended)
Margin between bottom of image and bottom of plot area. Specify value in absolute or relative measurements.
This attribute and the deprecated height attribute are mutually exclusive.
The minimum value for this attribute is 20 pixels if you have specified legend labels (see Legend).
width:distance (deprecated)
Specify value in absolute or relative measurements.
do not use anymore, see the right attribute above.
height:distance (deprecated)
Specify value in absolute or relative measurements.
do not use anymore, see the bottom attribute above.

Notes:

  1. The width and height attributes are only retained for downward compatibility. Earlier a plot area could only be defined by its total width and height, and left and bottom margins.
  2. Now you can specify all four margins, and are advised to do so, and not use width and height attributes anymore.
  3. The advantage is added flexibility: when you change the overall image size, you do not need to adjust the plotarea definition as well. This is even more important when the image size is calculated automatically (see ImageSize).

例:

PlotArea = left:40 bottom:60 top:10 right:10 # e.g. extra space to the left and below the plot area for axis labels and legend

PlotData

Used to define bars (symbolizing a time period), and add text next to these bars on a specific position.

For texts which are not related to a certain period or date/year or which require extensive formatting use command TextData.

Attributes text, at, from and till always apply only to the line on which they occur. All other attributes, when not combined with one of these four, act as default for the remainder of the command block or until a new default is specified, and may be overruled for a single line. See Parameters vs data items for more info and an example.

PlotData accepts a lot of attributes, some of which are mutually exclusive. These attributes can be grouped as follows:

  • Positional attributes
  • Bar related attributes
  • Text attributes
  • Marker attribute

Positional attributes

at:time (applies only to current line in data block)
Specifies at which date/year a text or marker should be positioned. Depending on attribute align the text either starts, ends or is centered at this position. Use date/year format as specified in DateFormat or specify start or end which refers to time frame defined by command Period.
Note: This attribute can not be combined with attributes from and till.
from:time (applies only to current line in data block)
till:time (applies only to current line in data block)
Specifies at which date/year a bar should start and end. Use date/year format as specified in DateFormat or specify start which refers to time frame defined by command Period.
Note: These two attributes should be used in combination and can not be combined with attribute at.
shift:(x,y) (optional)
Specifies a horizontal and vertical displacement in absolute measurements for a text. This allows:
  • Texts to be shifted to avoid overlaps between successive bars;
  • Placement of text beside a bar, instead of on top of it.

例:

PlotData=
  bar:Japan from:start      till:19/02/1945 color:JT
  bar:Japan from:19/02/1945 till:14/03/1945 color:AI
  bar:Japan from:02/09/1945 till:end        color:AO

  at:07/12/1941 shift:(0,-15) text:"<-- WW2 reaches Asia"

Bar related attributes

bar:bar-id
Specifies to which bar all other attributes apply (including the optional marker attributes and text attributes).
The bar-id specified here will also be the text presented along the axis, next to the bar.
  • When command BarData has not been used, bars will be drawn in the order in which they occur in any PlotData data block.
  • When command BarData has been used, bars will presented in the order specified there, also the bar-id specified here will be validated against that list. Also the text presented along the axis will depend on the definition in BarData.
barset:barset-id (optional)
Restarts the bar display "from the top", allowing multiple bars on the same line.
The specified barset-id must have been declared in BarData.
The default barset is anonymous and needs not be specified if there's no BarData.
Blank lines may be added to skip over lines that you do not wish to add to with declarations such as at:1234 with no further attributes. Multiple bars may then be specified on after this attribute.
color:color-id (optional)
Specifies the color is which the bar should be drawn.
The color id specified should be defined first with command Colors.
The default value will be the same color as the previously specified bar.
width:distance (optional)
Specifies the width of the bar in absolute or relative measurements.
The default value will be computed according to the total size of the PlotArea, and the maximum number of bars in all barsets (including the default anonymous barset).

例:

BarData=
  bar:US text:United States
  bar:SB text:Sea Battles

Colors=
  id:US value:blue legend:United_States
  id:SB value:rgb(0.8,0,0.7) legend:Sea_Battles

PlotData=
  width:0.3                                                            # see note 1
  bar:SB     from:07/08/1942 till:09/02/1943 text:Guadalcanal color:SB # see note 2
  bar:US     from:start      till:end color:US                         # see note 3
  bar:Midway from:start      till:end color:US                         # see note 4
  bar:US     at:07/12/1941   text:7/12 Pearl Harbour                   # see note 5

Notes:

  1. this line establishes a default bar width for the remainder of the data block
  2. this line specifies a bar to be drawn and a text to placed on it at the same time
  3. bar US will be drawn before bar SB, even when specified after it, because command BarData determines the sequence
  4. bar Midway will be rejected because it is not declared with command BarData
  5. the last line will not result in a bar being plotted, it merely specifies on which bar the text should be placed

Text attributes (optional)

text:some_text (applies only to current line in data block)
Defines a text that should be plotted on or near a bar.
Notes
  1. See also Text Input for rules.
  2. The text may include embedded links (see Notes 1 & 2) for use in clickable maps.
  3. See Clickable maps for information about texts with embedded links and limitations.
textcolor:color-id (optional)
Defines the color of the text. The color id specified should be defined first with command Colors. When not specified color black will be assumed.
fontsize:integer/tag (optional)
Specify a point size between 6 and 30, or (preferably) one of tags XS, S (default), M, L or XL. See Font support for more details.
anchor:middle/from/till (optional)
Specify the anchor position. If not defined, the anchor position is either explicitly set with the attribute at, or implicitly with the attributes from and till. In the latter case the text will be positioned in the middle of the defined bar segment.
align:center/left/right (optional)
Specify center (default), left or right.
link:URL (optional, applies only to current line in data block)
Specify a web link (see Note 1) (URL) for use in clickable maps. The text will be shown as a blue clickable link.
Notes
  1. This attribute can only be used with the text attribute.
  1. Either use attribute link, or an embedded link in attribute text, not both.
  1. On PNG images rendered as clickable maps, only one clickable link will be shown per text segment: text with line breaks (~) constitutes several segments.
  1. See Clickable maps for information about texts with embedded links and limitations.

例:

PlotData=
   bar:US at:07/12/1941 align:left textcolor:black fontsize:XS text:7/12 [[Pearl Harbour]]

同じ結果が生成されます:

PlotData=
   bar:US at:07/12/1941 align:left textcolor:black fontsize:XS text:"7/12 Pearl Harbour" link:http://www.wikipedia.org/wiki/Pearl_Harbour

Marker attribute (optional)

mark:(symbol,color-id)
Places a marker in a bar at the specified position.
  • The only value for symbol supported to date is line.
  • The color-id specified should be defined first with command Colors. When not specified color black will be assumed.

例:

PlotData=
  bar:test width:15 color:red
  from:1900 till:2000
  at:1990 mark:(line,white)

次のように表示されます:

ScaleMajor

This command divides the timeline into smaller periods, either

  • Graphically, through thin vertical or horizontal lines in the chart
  • Textually, through stubs in the time axis, below or to the left of the chart
  • Both graphically and textually
gridcolor:color-id (オプション)
目盛線の色を定義します。
この属性を省略すると、目盛線は描画されません。
指定されたcolor-idは、最初にコマンドColorsで定義する必要があります。
unit:time-unit (オプション)
目盛間隔を増分する時間単位を指定します。
day, month または year (デフォルト)を指定します。
DateFormat = yyyyが指定された場合、year単位だけが許されます。
increment:integer (オプション)
目盛間隔を増分する(ゼロ以外の)単位数を指定します。
デフォルトの増分は 1です。
start:time (オプション)
最初の目盛線やラベルを表示する場所を指定します。
デフォルトは、Periodで定義された startです。

Note: the orientation of the lines and/or placement of the stubs depends on the orientation of the TimeAxis.

例:

ScaleMajor = gridcolor:red start:1940

ScaleMajor = gridcolor:red unit:month increment:3 start:01/09/1939

ScaleMinor

This command defines a further subdivision of the timescale (see ScaleMajor for attributes syntax).

例:

ScaleMajor = grid:red  unit:year  increment:1 start:01/01/1940
ScaleMinor = grid:blue unit:month increment:3 start:01/10/1939

TextData

テキストブロックを定義するために使用されます。チャートのどこにでも配置できます。

text:some_text
実際のテキスト。
ルールについてはText Inputも参照。
テキストにはembedded linksが含まれる場合があります(Notes 1 & 2も参照)
pos:(x,y)
Defines the top-left corner of the text block in absolute or relative measurements.
link:URL (optional)
Specify a web link (see Note 1) for use in clickable maps.
The label along the axis will be shown as a blue clickable link.
textcolor:color-id (optional)
Defines the color of the text to draw.
The color-id specified should be defined first using Colors.
When not specified, the color is black.
fontsize:integer/tag (optional)
Specify a point size between 6 and 30, or (preferably) one of tags XS, S (default), M, L or XL (see Font support for more details).
tabs:(x1-alignment1,x2-alignment2...) (optional)
Defines position and alignment for tab character: ^ (caret).
Specify multiple tab settings as a comma-separated list of xn-alignn where
  • alignmentn is the alignment for the text segment (specify center, left or right).
lineheight:distance (optional)
Defines spacing between consecutive lines in absolute measurements.
Specify a value up to 40 pixels (or 0.4in).
When not specified a default lineheight will be based on the font size currently in use.

Notes:

  1. Either use attribute link, or an embedded link in attribute text, not both.
  2. On PNG images only one clickable link will be shown per text segment (text with tabs (^) constitutes several segments).

例:

TextData =
  pos:(20,67) textcolor:black fontsize:S
  tabs:(10-right,14-left,50-left,90-left,230-left)
  text:^1^1940^27/9^Germany,Italy and Japan sign [[Tripartite Pact]]
  text:^10^1944^1-22/7^Bretton Woods 44 nations establish
  text:^^^^^IMF and World Bank

次のように表示されます:

Tripartite Pact

TimeAxis (mandatory)

時間軸の方向と、その軸に併記するラベルのテキスト表現を定義します。

format:時刻の書式 (省略可能)
時間軸に併記する日付形式を指定します。
現在、yyyy(デフォルト)形式のみがサポートされています。これは、ScaleMajorunit:属性がyear以外に設定されている場合、major grid linesが軸ラベルと同期されないことを意味します。たとえば、unit:monthincrement:6を設定すると、major gridlinesが6か月ごとに作成されますが、軸ラベルは6 ごとにラベル付けされます。

さらに多くの形式がサポートされるかもしれません。

orientation:hor/ver
hor[izontal] またはver[tical]を指定します。
デフォルトの時間軸方向は水平です。
Specify hor[izontal] or ver[tical].
The default time axis orientation is horizontal.
order:reverse (オプション)
逆行時間とするオプションとしてreverseを指定します。
デフォルトは順方向時間す

例:

TimeAxis = orientation:horizontal format:yyyy

Presets

プリセットは、よく使用される設定の省略形です。 それらはコード行を省き、標準化を促進しますが、タイムラインスクリプトが自己記述的でなくなるため、混乱するかもしれません。

現在、2つのプリセットが利用可能です:

  • Preset = TimeVertical_OneBar_UnitYear, which expands to
PlotArea   = left:45 right:10 top:10 bottom:10
TimeAxis   = orientation:vertical format:yyyy
DateFormat = yyyy
AlignBars  = early
ScaleMajor = unit:year
ScaleMinor = unit:year
PlotData   =
   mark:(line,white) align:left fontsize:S width:20 shift:(20,0)
  • Preset = TimeHorizontal_AutoPlaceBars_UnitYear は次のように展開されます。
ImageSize  = height:auto barincrement:20
PlotArea   = left:25 right:25 top:15 bottom:30
TimeAxis   = orientation:horizontal format:yyyy
Colors = 
  id:canvas value:gray(0.7)
  id:grid1  value:gray(0.4)
  id:grid2  value:gray(0.2)
BackgroundColors = canvas:canvas
DateFormat = yyyy
AlignBars  = justify
ScaleMajor = unit:year grid:grid1
ScaleMinor = unit:year
Legend = orientation:vertical left:35 top:130
PlotData =
   align:left anchor:from fontsize:M width:15 shift:(4,-6) textcolor:black

Implementation and integration limitations

フォントのサポート

タイムラインの Unicode サポートは多少制限されています:

  • FreeSans.ttfフォントを使用します。これは、全ての可能なグリフのサブセットをサポートします。
  • たとえば、ラテンアルファベット、キリル語、ギリシャ語、アルメニア語のアルファベット、ヘブライ語のabjad(ただし、視覚的並べ替えなし)、デバナガリ語、ベンガル語、グルムキ語、グジャラート語、タミル語の西ヨーロッパおよび東ヨーロッパのダイアクリティックス、インド語のKannaraabugidas、カナ文字(基本的な日本語のみ)、および拡張された一般的な句読点、通貨単位記号、添え字/上付き数字、文字のような記号、分数とローマ数字、いくつかの矢印と数学演算子のサブセットをサポートします。
  • しかし、グルジア語のアルファベット、アラビア語のabjad、ハングル語のアルファベットとシラブル、オリヤー語、テルグ語のタイ語、ラオス語とチベット語のアブギダス、漢字とハン表意文字(中国語、韓国語、グルジア語、アラビア語、タイ語はサポートされていません。日本語はまだ基本的なカナとラテン文字で代替する必要があります)は欠けています;
  • また、Dingbatsや、サポートされている線画コマンドを使用して描画する必要のあるボックス描画文字などの非言語記号もサポートしていません。
  • LocalSettings.phpで様々なフォントを設定できます。これにより、Unicodeのサポートが向上する場合があります。たとえば、Malayalam語版ウィキペディアでは、Malayalam語のサポートが優れている別のフォントを使用しています。

ビットマップフォントの使用の名残りとして、5つのフォントタグのみが事前定義されています。これらは、PNG画像とSVG画像でわずかに異なるサイズでレンダリングされ、両方のプラットフォームで最適な読みやすさを実現します。 可能な限り、数字の代わりにこれらのタグを使用することをお勧めします。 そのフォントタグは次のとおりです。 'XS' = eXtra Small、 'S' = Small(デフォルト)、 'M' = Medium、 'L' = Large、 ' XL '= eXtra Large

EasyTimeline code with template parameter or magic words

テンプレート パラメーターや {{CURRENTDAY2}} のようなもので簡単なタイムラインを使用したい場合は、#tag 構文を使用できます:

{{#tag:timeline|
Timeline code here
}}

ただし、全ての|を {{!}} に置き換える必要があります(これは | のみを含むテンプレートである必要があります)。 詳細については、Help:マジックワード の #tag の節を参照してください。

埋込みリンクにおける既知のバグと制限

  • You can currently specify only one link per text segment.
  • Link trailers are not recognized, you must put the full text that is part of the link within "[[]]".
  • Links that are not specified at the beginning of the text (or the beginning of a new line after a line break specified by a tilde) are incorrectly positioned (the normal text color is used at the correct position, and the text with the blue link color is overdrawn on top of it with the wrong horizontal position). See the first example trying to show "Help:Link" above in this section.
  • If the displayed text in bar legends of a PlotData contains newlines (represented by a ~), the targer URL is broken, keeping only the first word in it.

    For example the following code in bar data:

      from:1935 till:2004 text:"[[Françoise Sagan|Françoise Quoirez,~alias Françoise Sagan]]" color:writer
    

    currently renders as

    where the target links to Françoise instead of Françoise Sagan, and shows the incorrect tooltip text "Françoise Sagan/.." with extra characters. This bug does not occur if the target link contains a single word. Surrounding the full text (with the link itself) with quotes does not solve the problem. Additionally, this requently causes the timeline to fail without showing the error during its rendering (no image rendered on the browser).

  • In addition the target is assumed as belonging to the same parent page as the current subpage even though the target link does not start with a "/" (with the wiki syntax), so timelines containing links are not usable in subpages (like this one).