From 77faead4e948f901fa6ca9951f085bbe045bae68 Mon Sep 17 00:00:00 2001
From: Pliable Pixels
- Install or download the vis.js library.
- in a subfolder of your project. Include the libraries script and css files in the
+ Install or download the vis.js library
+ in a subfolder of your project. Include the library's script and css files in the
head of your html code:
Loading
start,
end (optional), content,
- group (optional), className (optional),
+ group (optional), className (optional),
editable (optional), and style (optional).
format is:
@@ -583,8 +583,16 @@ function (option, path) {
year: ''
}
}
+
For values which not provided in the customized options.format, the default values will be used.
All available formatting syntax is described in the docs of moment.js.
+ function format({
+ minorLabels: Function(date: Date, scale: Number, step: Number),
+ majorLabels: Function(date: Date, scale: Number, step: Number)
+}
order properties are provided, the order will be undetermined.
-
+
content. See section Templates for a detailed explanation.content. See section Templates for a detailed explanation.zoomCtrl is defined or zoomable is false. Notice that defining this option as true will override verticalScroll scroll event but not eliminate the vertical scrollbar.
+ selectable is true.
selectable and editable.add are set true.
selectable and editable.updateTime or editable.updateGroup are set true.
selectable and editable.remove are set true.
falsedir="rtl". The timeline knows to take the nearest parent node direction and apply it. Notice that the timeline will prefer the option.rtl over any parent dir="rtl"content. See section Templates for a detailed explanation.0content. See section Templates for a detailed explanation.falseeditable.updateTime must be truefalsetrue will NOT override horizontalScroll. The scroll event will be vertically ignored, but a vertical scrollbar will be visible
+ rangechange, rangechanged, select. The callback function is invoked as callback(properties), where properties is an object containing event specific properties. See section Events for more information.rangechange, rangechanged, select, itemover, itemout. The callback function is invoked as callback(properties), where properties is an object containing event specific properties. See section Events for more information.time can be a Date object, numeric timestamp, or ISO date string.
- Parameter id is the idof the custom time bar, and is undefined by default.
+ Parameter id is the id of the custom time bar, and is undefined by default.
percentage can be a Number and must be between 0 and 1. If the parameter value of percentage is null, the window will be left unchanged.
+ percentage can be a Number and must be between 0 and 1. If the parameter value of percentage is null, the window will be left unchanged.
+ @@ -1314,7 +1362,7 @@ document.getElementById('myTimeline').onclick = function (event) {
timeline.on('select', function (properties) {
- alert('selected items: ' + properties.nodes);
+ alert('selected items: ' + properties.items);
});
@@ -1324,7 +1372,7 @@ timeline.on('select', function (properties) {
function onSelect (properties) {
- alert('selected items: ' + properties.nodes);
+ alert('selected items: ' + properties.items);
}
// add event listener
@@ -1442,6 +1490,28 @@ timeline.off('select', onSelect);
+
+ itemover
+
+
+ item: hovered item id
+ event: the original mouseover event
+
+
+ Fired when the user moves the mouse over an item.
+
+
+
+ itemout
+
+
+ item: hovered item id
+ event: the original mouseout event
+
+
+ Fired when the user moves the mouse out of an item.
+
+
timechange
@@ -1528,7 +1598,9 @@ var items = new vis.DataSet([
item: the item being manipulated
- callback: a callback function which must be invoked to report back. The callback must be invoked as callback(item or null). Here, item can contain changes to the passed item. Parameter `item` typically contains fields `content`, `start`, and optionally `end`. The type of `start` and `end` is determined by the DataSet type configuration and is `Date` by default. When invoked as callback(null), the action will be cancelled.
+ callback: a callback function which must be invoked to report back. The callback must be invoked as callback(item) or callback(null).
+ Here, item can contain changes to the passed item. Parameter item typically contains fields `content`, `start`, and optionally `end`. The type of `start`
+ and `end` is determined by the DataSet type configuration and is `Date` by default. When invoked as callback(null), the action will be cancelled.
@@ -1554,7 +1626,7 @@ var items = new vis.DataSet([
Templates
- Timeline supports templates to format item contents. Any template engine (such as handlebars or mustache) can be used, and one can also manually build HTML. In the options, one can provide a template handler. This handler is a function accepting an items data as argument, and outputs formatted HTML:
+ Timeline supports templates to format item contents. Any template engine (such as handlebars or mustache) can be used, and one can also manually build HTML. In the options, one can provide a template handler. This handler is a function accepting an item's data as argument, and outputs formatted HTML:
var options = {
@@ -1601,6 +1673,17 @@ var template = Handlebars.compile(source);
};
+React templates
+
+You can use a React component for the templates by rendering them to the templates' element directly:
+
+
+ template: function (item, element) {
+ return ReactDOM.render(<b>{item.content}</b>, element);
+ },
+
+
+
Multiple templates
In order to support multiple templates, the template handler can be extended to switch between different templates, depending on a specific item property:
@@ -1640,7 +1723,7 @@ var options = {
Create a new locale
- To load a locale into the Timeline not supported by default, one can add a new locale to the option locales:
+ To load a locale (that is not supported by default) into the Timeline, one can add a new locale to the option locales:
var options = {
locales: {
@@ -1675,6 +1758,14 @@ var options = {
en_US
+
+ Italian
+
+ it
+ it_IT
+ it_CH
+
+
Dutch
@@ -1682,13 +1773,20 @@ var options = {
nl_NL
nl_BE
+
+
+ German
+
+ de
+ de_DE
+
Time zone
- By default, the Timeline displays time in local time. To display a Timeline in an other time zone or in UTC, the date constructor can be overloaded via the configuration option moment, which by default is the constructor function of moment.js. More information about UTC with moment.js can be found in the docs: http://momentjs.com/docs/#/parsing/utc/.
+ By default, the Timeline displays time in local time. To display a Timeline in another time zone or in UTC, the date constructor can be overloaded via the configuration option moment, which by default is the constructor function of moment.js. More information about UTC with moment.js can be found in the docs: http://momentjs.com/docs/#/parsing/utc/.
@@ -1762,7 +1860,7 @@ var options = {
Days vis-date1, vis-date2, ..., vis-date31
- Months vis-januari, vis-februari, vis-march, vis-april, vis-may, vis-june, vis-july, vis-august, vis-september, vis-october, vis-november, vis-december
+ Months vis-january, vis-february, vis-march, vis-april, vis-may, vis-june, vis-july, vis-august, vis-september, vis-october, vis-november, vis-december
Years vis-year2014, vis-year2015, ...
--
cgit v1.2.3