Release status: beta
|Description||Allow the insertion of interactive timelines using the vis.js library|
|Author(s)||Chris Page (Ishtralimnartalk)|
|Latest version||1.9 (Canada Water) (2019-05-11)|
|License||GNU General Public License 2.0|
This extension is not currently available via the standard MediaWiki extension distributor. To install the extension, you should clone the Git repository into your extensions directory as shown here:
cd extensions/ git clone https://github.com/TheWatcher/InteractiveTimeline.git cd InteractiveTimeline git checkout REL1_32
Once you have cloned the repository, add the following code at the bottom of your LocalSettings.php:
If you are upgrading from a version of InteractiveTimeline before v1.9, you are strongly advised to delete the old InteractiveTimeline directory from your extensions, and clone a new one.
- $wgITvisjsCDNjs = "https://host.com/path/to/vis.min.js"
- Set this to the location the extension should load the vis.min.js file from. This defaults to https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.js
- $wgITvisjsCDNcss = "https://host.com/path/to/vis.min.css"
- Set this to the location the extension should load the vis.min.css file from. This defaults to https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.css
Once installed, you can place
<itimeline>...</itimeline> tags in pages where you want to show a timeline. A large number of parameters may be set in the <itimeline> tag, but all of them are optional. The contents of the tag should be a series of events, with one event defined per line. For example:
<itimeline height="512px" min="2014-06-01" max="2014-08-30"> <!-- These two lines define events that happen at a particular time --> 2014-07-25T13:00:00Z|Design|[[Target 1|Target 1]] 2014-07-26T10:00:00Z|Design|[[Target 2|Target 2]] <!-- These three are ranges, defined using IS8601 intervals with start and end dates and times --> 2014-07-25T08:00:00Z/2014-07-26T15:00:00Z|Implement|[[Phase 1]] 2014-07-26T12:00:00Z/2014-07-27T15:00:00Z|Implement|[[Phase 2]] 2014-07-25T08:00:00Z/2014-08-00:00:00+02:00|Implement|Project 1 <!-- Available in v1.3: support for grouping. These three lines define events grouped in the 'last phase' group --> 2014-07-25T13:00:00Z|[[File:Nuvola apps important.svg|16px]] Coalface|[[Target 1/Deploy]] 2014-07-25T13:10:00Z|[[File:Nuvola apps important.svg|16px]] Coalface|[[Target 1/Panic]] 2014-07-25T13:15:00Z|[[File:Nuvola apps important.svg|16px]] Coalface|[[Target 1/Rollback]] </itimeline>
Dates and times
All dates and times specified in an <itimeline> tag, whether as a value provided for a parameter, or as part of an event definition, should be formatted using a profile of ISO 8601. The dates and times accepted by InteractiveTimeline should take the form of a calendar date, optionally followed by a time:
- Dates should be specified as a four digit year (the year including the century), followed by a two digit month (01 to 12), followed by a two digit day (01 to 31), with the sections optionally separated by hyphens. The form of the date should be
YYYYMMDD, for example:
- Dates before 0000-01-01 are not supported at present - I'm working on reliable support for them.
- If a time is not specified, the default of "00:00:00Z" (midnight UTC) is used for the time.
- If a time is specified, it must be separated from the date by exactly one space ' ', or the character 'T'.
- When provided, times should be specified as a two digit hour (00 to 23), followed by a two digit minute (00 to 59), followed by a two digit second (00 to 59), with the fields optionally separated by colons. The time should be of the form
HHMMSS. The minutes and seconds are optional, and if not specified they default to "00". Decimal fractions are not supported for the time fields. Times must be followed by a time zone designator.
- The time zone designator should either be "Z" to indicate that the time is in UTC, or it can be an offset from UTC specified as a positive or negative hours (and optionally minutes) of the form ±[HH]:[MM], ±[HH][MM], or ±[HH].
For example, the following dates and times are valid:
2014-07-12 17:10Z(5:10pm UTC on the 12th of July 2014)
2014-08-14(00:00 UTC on the 14th of August 2014)
2014-07-12T13:12:10-05:00(13:12:10 in Central Daylight Time on the 12th of July 2014)
2014-08-14 08:24+02(8:24am in Central European Summer Time on the 14th of August 2014)
The following parts of ISO 8601 are not supported by InteractiveTimeline:
- 'Reduced precision' dates (YYYY year only, or YYYY-MM year and month); only complete calendar dates are supported.
- Week dates
- Ordinal dates
- Decimal fractions for hours, minutes, or seconds.
- Optional time zone designator (the time zone designator must be specified if a time is given)
- Intervals are only partially supported (see the <start>/<end> event syntax given below) - intervals including durations are not supported.
- Repeating intervals
- Truncated representations
- Timescales to represent non-Gregorian calendars
The following parameters may be specified in the <itimeline> tag. All parameters are optional and case sensitive, and if not specified the default is used.
|end||datetime||none||The date at the end of the timeline view when the timeline is initially shown. If not set, the date and time of the last event in the timeline is used.|
|height||string||auto||The height of the timeline. This can be a height in any valid css size unit (px, em, %, etc) or 'auto' to indicate that the height should be calculated automatically. When height is set to "auto", a minimum height can be specified with the option minheight.|
|locale||string||en||Select the locale to use inside the CHAP Timeline library. Supported locales are:
|max||datetime||none||The maximum date that can be shown in the timeline. If set, it is not possible to move the timeline beyond this point (not to be confused with the 'end' parameter which controls the initial view end date). The maximum itself is excluded. If not set, no maximum is enforced.|
|min||datetime||none||The minimum date that can be shown in the timeline. If set, it is not possible to move the timeline before this point (not be confused with the 'start', which controls the initial view start date). The minimum is included. If not set, no minimum is enforced.|
|minheight||int||0||The minimum height of the timeline in pixels when 'height' has been set to "auto".|
|moveable||boolean||true||If true, the timeline is moveable.|
|stack||boolean||true||If true, the events are stacked above each other to prevent overlapping events.|
|start||datetime||none||The date at the beginning of the timeline view when the timeline is initially shown. If not set, the date and time of the first event in the timeline is used.|
|showcurrenttime||boolean||true||If true, the timeline shows a red, vertical line displaying the current time.|
|showmajorlabels||boolean||true||By default, the timeline shows both minor and major date labels on the horizontal axis. For example the minor labels show minutes and the major labels show hours. When showmajorlabels is false, no major labels are shown.|
|showminorlabels||boolean||true||By default, the timeline shows both minor and major date labels on the horizontal axis. For example the minor labels show minutes and the major labels show hours. When showminorlabels is false, no minor labels are shown. When both showmajorlabels and showminorlabels are false, no horizontal axis will be visible.|
|width||string||100%||The width of the timeline. This can be any valid css size unit (px, em, %, etc).|
|zoomable||boolean||true||If true, the timeline is zoomable.|
|zoommax||int||315360000000000||Set a maximum zoom interval for the visible range in milliseconds. It will not be possible to zoom out further than this maximum. Default value equals about 10000 years.|
|zoommin||int||10||Set a minimum zoom interval for the visible range in milliseconds. It will not be possible to zoom in further than this minimum.|
Additional documentation for the supported configuration options can be found in the vis.js Timeline documentation. Note that some of the configuration options listed on that page are not supported by this extension, either because they make no sense to include, for security, or simply because I haven't added them yet.
Inside the <itimeline> tag you define the list of events to show in the timeline. You should include one event per line, and events may not span multiple lines. Events are defined using:
- <datetime>|<event text>
- This format defines an event by giving the time of the event and some text describing the event.
- <datetime>/<datetime>|<event text>
- This format defines a range using an IS8601 interval. The first datetime is the date and time at which the range starts, the second is the end date and time (inclusive).
- <datetime>|<group name>|<event text>
- This format defines an event in a group by giving the time of the event, the name of the group to place the event in, and some text describing the event.
- <datetime>/<datetime>|<group name>|<event text>
2014-07-25T08:00:00Z/2014-08-00:00:00+02:00|first phase|Be agile
- This format defines an event range in a group. The first datetime is the date and time at which the range starts, the second is the end date and time (inclusive), the group name determines which group the range should be in, and the text describes the event.
'datetime' values should be provided in the format discussed above in the Dates and times section. The 'group name' and 'event text' may contain wiki text, so you may include images, links, or other formatting. Please note that complex wiki text should be avoided, or you will probably make the Timeline display go wonky: don't expect lists, tables, or anything complicated to work as expected.
If you set a group for any of the events set for a given <itimeline>, you MUST specify groups for all the other events in that <itimeline> If you do not, events without a group will not be shown!
The order in which events are defined is not important, and if the extension can not validate the definition of an event, it will be ignored.
The body of the <itimeline> tag supports transclusion and template expansion, so you may define a list of events elsewhere and transclude them into the body of the <itimeline> tag.
A publicly accessible MediaWiki demo of this extension is not currently available. The Timeline documentation contains a number of examples of the capabilities of the Timeline library.