vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2203 lines
89 KiB

Implementation of a week scale feature (#3009) * Add Gitter badge (#2179) * do not generate source-maps in distribution version * add 'dist' folder for deployment * added Badges * added codeclimate badge * added @Tooa to the support team * added badges from isitmaintained.com (#2517) * do not ignore dist and test folders in master * generated dist files for v4.18.0 * generated dist files for v4.18.1 * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * changed to v4.18.1-SNAPSHOT * chore(docs): general improvements (#2652) * removed NOTICE file * updated license date range to include 2017 * chore(docs): updated support team members * chore: updated dependencies and devDependencies (#2649) * Fixes instanceof Object statements for objects from other windows and iFrames. (#2631) * Replaces instanceof Object checks with typeof to prevent cross tab issues. * Adds missing space. * chore: removed google-analytics from all examples (#2670) * chore(docs): Add note that PRs should be submitted against the `develop` branch (#2623) Related to: https://github.com/almende/vis/pull/2618 Related to: https://github.com/almende/vis/pull/2620 * feat(timeline): Change setCustomTimeTitle title parameter to be a string or a function (#2611) * change setCustomTimeTitle title parameter, Now could be an string or a function * Fixed indent and spacing * feat(timeline): refactor tooltip to only use one dom-element (#2662) * feat(network): Allow for image nodes to have a selected or broken image (#2601) * feat(tests): run mocha tests in travis ci (#2687) * Added showX(YZ)Axis options to Graph3d (#2686) * Added showX(YZ)Axis to Graph3d * Added show_Axis options to docs and playground example * Resolved merge conflict * Added show_Axis options to docs and playground example * fix(build): use babel version compatible with webpack@1.14 (#2693) fixes #2685 * feat(docs): use babel preset2015 for custom builds (#2678) * add link to a mentioned example (#2709) * chore(lint): added support for eslint (#2695) * Trivial typo fix in how_to_help doc. (#2714) * fix(timeline): #2598 Flickering onUpdateTimeTooltip (#2702) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add animation to onUpdateTooltip * fix(timeline): #778 Tooltip does not work with background items in timeline (#2703) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Make items z-index default to 1 * Add initial tests for Timeline PointItem (#2716) * fix(timeline): #2679 TypeError: Cannot read property 'hasOwnProperty' of null (#2735) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix bug in item editable * feat(timeline): #2647 Dynamic rolling mode option (#2705) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add toggleRollingMode option * Update docs with toggleRollingMode option * fixes timestep next issue (#2732) * feat(timeline): added new locales for french and espanol (#2723) * Fix eslint problem on Travis. (#2744) * fix: Range.js "event" is undeclared (#2749) * fix(timeline): #2720 Problems with option editable (#2743) Clean up and centralise edit status for Timeline Items. * feat(network): Improve the performance of the network layout engine (#2729) * Improve the performance of the network layout engine Short-cut the execution of a number of methods in LayoutEngine to make them handle highly-connected graphs better. * Demonstrations of layouts of large networks * Added support to supply an end to bar charts to have them scale (#2760) * Added support to supply an X2 to bar charts to have them scale * Fixed graph2d stacking issue. It no longer takes into account hidden items * Changed x2 to end per recommendation and added this to the docs * Initial tests for timeline ItemSet. (#2750) Somewhat more complicated setup, associated with the need for a real window. * [Timeline] Modify redraw logic to treat scroll as needing restack. (#2774) This addresses #1982 and #1417. It possibly reduces performance, but correctness seems better. * fix(timeline): #2672 Item events original event (#2704) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix events returned from mouse events * Fix example * Rename censor to stringifyObject in example * [timeline] Update examples to use ISOString format. (#2791) Resolves #2790 * [timeline] Update serialization example to use ISOString dates. (#2789) Resolves #2696 * added github templates for issues and pull-requests (#2787) fixes #2418 * feat(timeline): Add item data as argument to the template function (#2799) * Fix regression introduced in #2743. (#2796) * Fix for issue #2536 (#2803) * Fix for issue #2536 * Adjusted documentation for fix. * Adjustments due to review * Grrrrr whitespace * Fixed Travis issue * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * Update to gitignore to reflect changes on remote * clean dist folder * Local gitignore update * Just a first example file for the week scale feature * Allowing sourcemap creation * Initial (non-functional) commit to ensure we insert code at the right places (check TODOs) * Functional, not bug-free version which works with locale aware week numbers. * Locale-aware implementation and simplified major labels to a full year * Trying to make the major labels show the correct start date * Working implementation of week numbers using localization. * removing development leftovers * Updated package.json * Reintagrate package.json from accidental deletion * Updates for package.json * Fixing package.json * Integrate the week numbers feature in the documentation. * Reverting local changes to .gitignore * Reverting local changes * Extending examples to cover the case when 1st day of week and 1st day of month align; Fixing display bug so that week numbers are not repeated in minorLabels * Putting the examples into a loop
7 years ago
Implementation of a week scale feature (#3009) * Add Gitter badge (#2179) * do not generate source-maps in distribution version * add 'dist' folder for deployment * added Badges * added codeclimate badge * added @Tooa to the support team * added badges from isitmaintained.com (#2517) * do not ignore dist and test folders in master * generated dist files for v4.18.0 * generated dist files for v4.18.1 * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * changed to v4.18.1-SNAPSHOT * chore(docs): general improvements (#2652) * removed NOTICE file * updated license date range to include 2017 * chore(docs): updated support team members * chore: updated dependencies and devDependencies (#2649) * Fixes instanceof Object statements for objects from other windows and iFrames. (#2631) * Replaces instanceof Object checks with typeof to prevent cross tab issues. * Adds missing space. * chore: removed google-analytics from all examples (#2670) * chore(docs): Add note that PRs should be submitted against the `develop` branch (#2623) Related to: https://github.com/almende/vis/pull/2618 Related to: https://github.com/almende/vis/pull/2620 * feat(timeline): Change setCustomTimeTitle title parameter to be a string or a function (#2611) * change setCustomTimeTitle title parameter, Now could be an string or a function * Fixed indent and spacing * feat(timeline): refactor tooltip to only use one dom-element (#2662) * feat(network): Allow for image nodes to have a selected or broken image (#2601) * feat(tests): run mocha tests in travis ci (#2687) * Added showX(YZ)Axis options to Graph3d (#2686) * Added showX(YZ)Axis to Graph3d * Added show_Axis options to docs and playground example * Resolved merge conflict * Added show_Axis options to docs and playground example * fix(build): use babel version compatible with webpack@1.14 (#2693) fixes #2685 * feat(docs): use babel preset2015 for custom builds (#2678) * add link to a mentioned example (#2709) * chore(lint): added support for eslint (#2695) * Trivial typo fix in how_to_help doc. (#2714) * fix(timeline): #2598 Flickering onUpdateTimeTooltip (#2702) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add animation to onUpdateTooltip * fix(timeline): #778 Tooltip does not work with background items in timeline (#2703) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Make items z-index default to 1 * Add initial tests for Timeline PointItem (#2716) * fix(timeline): #2679 TypeError: Cannot read property 'hasOwnProperty' of null (#2735) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix bug in item editable * feat(timeline): #2647 Dynamic rolling mode option (#2705) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add toggleRollingMode option * Update docs with toggleRollingMode option * fixes timestep next issue (#2732) * feat(timeline): added new locales for french and espanol (#2723) * Fix eslint problem on Travis. (#2744) * fix: Range.js "event" is undeclared (#2749) * fix(timeline): #2720 Problems with option editable (#2743) Clean up and centralise edit status for Timeline Items. * feat(network): Improve the performance of the network layout engine (#2729) * Improve the performance of the network layout engine Short-cut the execution of a number of methods in LayoutEngine to make them handle highly-connected graphs better. * Demonstrations of layouts of large networks * Added support to supply an end to bar charts to have them scale (#2760) * Added support to supply an X2 to bar charts to have them scale * Fixed graph2d stacking issue. It no longer takes into account hidden items * Changed x2 to end per recommendation and added this to the docs * Initial tests for timeline ItemSet. (#2750) Somewhat more complicated setup, associated with the need for a real window. * [Timeline] Modify redraw logic to treat scroll as needing restack. (#2774) This addresses #1982 and #1417. It possibly reduces performance, but correctness seems better. * fix(timeline): #2672 Item events original event (#2704) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix events returned from mouse events * Fix example * Rename censor to stringifyObject in example * [timeline] Update examples to use ISOString format. (#2791) Resolves #2790 * [timeline] Update serialization example to use ISOString dates. (#2789) Resolves #2696 * added github templates for issues and pull-requests (#2787) fixes #2418 * feat(timeline): Add item data as argument to the template function (#2799) * Fix regression introduced in #2743. (#2796) * Fix for issue #2536 (#2803) * Fix for issue #2536 * Adjusted documentation for fix. * Adjustments due to review * Grrrrr whitespace * Fixed Travis issue * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * Update to gitignore to reflect changes on remote * clean dist folder * Local gitignore update * Just a first example file for the week scale feature * Allowing sourcemap creation * Initial (non-functional) commit to ensure we insert code at the right places (check TODOs) * Functional, not bug-free version which works with locale aware week numbers. * Locale-aware implementation and simplified major labels to a full year * Trying to make the major labels show the correct start date * Working implementation of week numbers using localization. * removing development leftovers * Updated package.json * Reintagrate package.json from accidental deletion * Updates for package.json * Fixing package.json * Integrate the week numbers feature in the documentation. * Reverting local changes to .gitignore * Reverting local changes * Extending examples to cover the case when 1st day of week and 1st day of month align; Fixing display bug so that week numbers are not repeated in minorLabels * Putting the examples into a loop
7 years ago
Implementation of a week scale feature (#3009) * Add Gitter badge (#2179) * do not generate source-maps in distribution version * add 'dist' folder for deployment * added Badges * added codeclimate badge * added @Tooa to the support team * added badges from isitmaintained.com (#2517) * do not ignore dist and test folders in master * generated dist files for v4.18.0 * generated dist files for v4.18.1 * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * changed to v4.18.1-SNAPSHOT * chore(docs): general improvements (#2652) * removed NOTICE file * updated license date range to include 2017 * chore(docs): updated support team members * chore: updated dependencies and devDependencies (#2649) * Fixes instanceof Object statements for objects from other windows and iFrames. (#2631) * Replaces instanceof Object checks with typeof to prevent cross tab issues. * Adds missing space. * chore: removed google-analytics from all examples (#2670) * chore(docs): Add note that PRs should be submitted against the `develop` branch (#2623) Related to: https://github.com/almende/vis/pull/2618 Related to: https://github.com/almende/vis/pull/2620 * feat(timeline): Change setCustomTimeTitle title parameter to be a string or a function (#2611) * change setCustomTimeTitle title parameter, Now could be an string or a function * Fixed indent and spacing * feat(timeline): refactor tooltip to only use one dom-element (#2662) * feat(network): Allow for image nodes to have a selected or broken image (#2601) * feat(tests): run mocha tests in travis ci (#2687) * Added showX(YZ)Axis options to Graph3d (#2686) * Added showX(YZ)Axis to Graph3d * Added show_Axis options to docs and playground example * Resolved merge conflict * Added show_Axis options to docs and playground example * fix(build): use babel version compatible with webpack@1.14 (#2693) fixes #2685 * feat(docs): use babel preset2015 for custom builds (#2678) * add link to a mentioned example (#2709) * chore(lint): added support for eslint (#2695) * Trivial typo fix in how_to_help doc. (#2714) * fix(timeline): #2598 Flickering onUpdateTimeTooltip (#2702) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add animation to onUpdateTooltip * fix(timeline): #778 Tooltip does not work with background items in timeline (#2703) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Make items z-index default to 1 * Add initial tests for Timeline PointItem (#2716) * fix(timeline): #2679 TypeError: Cannot read property 'hasOwnProperty' of null (#2735) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix bug in item editable * feat(timeline): #2647 Dynamic rolling mode option (#2705) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add toggleRollingMode option * Update docs with toggleRollingMode option * fixes timestep next issue (#2732) * feat(timeline): added new locales for french and espanol (#2723) * Fix eslint problem on Travis. (#2744) * fix: Range.js "event" is undeclared (#2749) * fix(timeline): #2720 Problems with option editable (#2743) Clean up and centralise edit status for Timeline Items. * feat(network): Improve the performance of the network layout engine (#2729) * Improve the performance of the network layout engine Short-cut the execution of a number of methods in LayoutEngine to make them handle highly-connected graphs better. * Demonstrations of layouts of large networks * Added support to supply an end to bar charts to have them scale (#2760) * Added support to supply an X2 to bar charts to have them scale * Fixed graph2d stacking issue. It no longer takes into account hidden items * Changed x2 to end per recommendation and added this to the docs * Initial tests for timeline ItemSet. (#2750) Somewhat more complicated setup, associated with the need for a real window. * [Timeline] Modify redraw logic to treat scroll as needing restack. (#2774) This addresses #1982 and #1417. It possibly reduces performance, but correctness seems better. * fix(timeline): #2672 Item events original event (#2704) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix events returned from mouse events * Fix example * Rename censor to stringifyObject in example * [timeline] Update examples to use ISOString format. (#2791) Resolves #2790 * [timeline] Update serialization example to use ISOString dates. (#2789) Resolves #2696 * added github templates for issues and pull-requests (#2787) fixes #2418 * feat(timeline): Add item data as argument to the template function (#2799) * Fix regression introduced in #2743. (#2796) * Fix for issue #2536 (#2803) * Fix for issue #2536 * Adjusted documentation for fix. * Adjustments due to review * Grrrrr whitespace * Fixed Travis issue * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * Update to gitignore to reflect changes on remote * clean dist folder * Local gitignore update * Just a first example file for the week scale feature * Allowing sourcemap creation * Initial (non-functional) commit to ensure we insert code at the right places (check TODOs) * Functional, not bug-free version which works with locale aware week numbers. * Locale-aware implementation and simplified major labels to a full year * Trying to make the major labels show the correct start date * Working implementation of week numbers using localization. * removing development leftovers * Updated package.json * Reintagrate package.json from accidental deletion * Updates for package.json * Fixing package.json * Integrate the week numbers feature in the documentation. * Reverting local changes to .gitignore * Reverting local changes * Extending examples to cover the case when 1st day of week and 1st day of month align; Fixing display bug so that week numbers are not repeated in minorLabels * Putting the examples into a loop
7 years ago
Implementation of a week scale feature (#3009) * Add Gitter badge (#2179) * do not generate source-maps in distribution version * add 'dist' folder for deployment * added Badges * added codeclimate badge * added @Tooa to the support team * added badges from isitmaintained.com (#2517) * do not ignore dist and test folders in master * generated dist files for v4.18.0 * generated dist files for v4.18.1 * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * changed to v4.18.1-SNAPSHOT * chore(docs): general improvements (#2652) * removed NOTICE file * updated license date range to include 2017 * chore(docs): updated support team members * chore: updated dependencies and devDependencies (#2649) * Fixes instanceof Object statements for objects from other windows and iFrames. (#2631) * Replaces instanceof Object checks with typeof to prevent cross tab issues. * Adds missing space. * chore: removed google-analytics from all examples (#2670) * chore(docs): Add note that PRs should be submitted against the `develop` branch (#2623) Related to: https://github.com/almende/vis/pull/2618 Related to: https://github.com/almende/vis/pull/2620 * feat(timeline): Change setCustomTimeTitle title parameter to be a string or a function (#2611) * change setCustomTimeTitle title parameter, Now could be an string or a function * Fixed indent and spacing * feat(timeline): refactor tooltip to only use one dom-element (#2662) * feat(network): Allow for image nodes to have a selected or broken image (#2601) * feat(tests): run mocha tests in travis ci (#2687) * Added showX(YZ)Axis options to Graph3d (#2686) * Added showX(YZ)Axis to Graph3d * Added show_Axis options to docs and playground example * Resolved merge conflict * Added show_Axis options to docs and playground example * fix(build): use babel version compatible with webpack@1.14 (#2693) fixes #2685 * feat(docs): use babel preset2015 for custom builds (#2678) * add link to a mentioned example (#2709) * chore(lint): added support for eslint (#2695) * Trivial typo fix in how_to_help doc. (#2714) * fix(timeline): #2598 Flickering onUpdateTimeTooltip (#2702) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add animation to onUpdateTooltip * fix(timeline): #778 Tooltip does not work with background items in timeline (#2703) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Make items z-index default to 1 * Add initial tests for Timeline PointItem (#2716) * fix(timeline): #2679 TypeError: Cannot read property 'hasOwnProperty' of null (#2735) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix bug in item editable * feat(timeline): #2647 Dynamic rolling mode option (#2705) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add toggleRollingMode option * Update docs with toggleRollingMode option * fixes timestep next issue (#2732) * feat(timeline): added new locales for french and espanol (#2723) * Fix eslint problem on Travis. (#2744) * fix: Range.js "event" is undeclared (#2749) * fix(timeline): #2720 Problems with option editable (#2743) Clean up and centralise edit status for Timeline Items. * feat(network): Improve the performance of the network layout engine (#2729) * Improve the performance of the network layout engine Short-cut the execution of a number of methods in LayoutEngine to make them handle highly-connected graphs better. * Demonstrations of layouts of large networks * Added support to supply an end to bar charts to have them scale (#2760) * Added support to supply an X2 to bar charts to have them scale * Fixed graph2d stacking issue. It no longer takes into account hidden items * Changed x2 to end per recommendation and added this to the docs * Initial tests for timeline ItemSet. (#2750) Somewhat more complicated setup, associated with the need for a real window. * [Timeline] Modify redraw logic to treat scroll as needing restack. (#2774) This addresses #1982 and #1417. It possibly reduces performance, but correctness seems better. * fix(timeline): #2672 Item events original event (#2704) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix events returned from mouse events * Fix example * Rename censor to stringifyObject in example * [timeline] Update examples to use ISOString format. (#2791) Resolves #2790 * [timeline] Update serialization example to use ISOString dates. (#2789) Resolves #2696 * added github templates for issues and pull-requests (#2787) fixes #2418 * feat(timeline): Add item data as argument to the template function (#2799) * Fix regression introduced in #2743. (#2796) * Fix for issue #2536 (#2803) * Fix for issue #2536 * Adjusted documentation for fix. * Adjustments due to review * Grrrrr whitespace * Fixed Travis issue * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * Update to gitignore to reflect changes on remote * clean dist folder * Local gitignore update * Just a first example file for the week scale feature * Allowing sourcemap creation * Initial (non-functional) commit to ensure we insert code at the right places (check TODOs) * Functional, not bug-free version which works with locale aware week numbers. * Locale-aware implementation and simplified major labels to a full year * Trying to make the major labels show the correct start date * Working implementation of week numbers using localization. * removing development leftovers * Updated package.json * Reintagrate package.json from accidental deletion * Updates for package.json * Fixing package.json * Integrate the week numbers feature in the documentation. * Reverting local changes to .gitignore * Reverting local changes * Extending examples to cover the case when 1st day of week and 1st day of month align; Fixing display bug so that week numbers are not repeated in minorLabels * Putting the examples into a loop
7 years ago
Implementation of a week scale feature (#3009) * Add Gitter badge (#2179) * do not generate source-maps in distribution version * add 'dist' folder for deployment * added Badges * added codeclimate badge * added @Tooa to the support team * added badges from isitmaintained.com (#2517) * do not ignore dist and test folders in master * generated dist files for v4.18.0 * generated dist files for v4.18.1 * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * changed to v4.18.1-SNAPSHOT * chore(docs): general improvements (#2652) * removed NOTICE file * updated license date range to include 2017 * chore(docs): updated support team members * chore: updated dependencies and devDependencies (#2649) * Fixes instanceof Object statements for objects from other windows and iFrames. (#2631) * Replaces instanceof Object checks with typeof to prevent cross tab issues. * Adds missing space. * chore: removed google-analytics from all examples (#2670) * chore(docs): Add note that PRs should be submitted against the `develop` branch (#2623) Related to: https://github.com/almende/vis/pull/2618 Related to: https://github.com/almende/vis/pull/2620 * feat(timeline): Change setCustomTimeTitle title parameter to be a string or a function (#2611) * change setCustomTimeTitle title parameter, Now could be an string or a function * Fixed indent and spacing * feat(timeline): refactor tooltip to only use one dom-element (#2662) * feat(network): Allow for image nodes to have a selected or broken image (#2601) * feat(tests): run mocha tests in travis ci (#2687) * Added showX(YZ)Axis options to Graph3d (#2686) * Added showX(YZ)Axis to Graph3d * Added show_Axis options to docs and playground example * Resolved merge conflict * Added show_Axis options to docs and playground example * fix(build): use babel version compatible with webpack@1.14 (#2693) fixes #2685 * feat(docs): use babel preset2015 for custom builds (#2678) * add link to a mentioned example (#2709) * chore(lint): added support for eslint (#2695) * Trivial typo fix in how_to_help doc. (#2714) * fix(timeline): #2598 Flickering onUpdateTimeTooltip (#2702) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add animation to onUpdateTooltip * fix(timeline): #778 Tooltip does not work with background items in timeline (#2703) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Make items z-index default to 1 * Add initial tests for Timeline PointItem (#2716) * fix(timeline): #2679 TypeError: Cannot read property 'hasOwnProperty' of null (#2735) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix bug in item editable * feat(timeline): #2647 Dynamic rolling mode option (#2705) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add toggleRollingMode option * Update docs with toggleRollingMode option * fixes timestep next issue (#2732) * feat(timeline): added new locales for french and espanol (#2723) * Fix eslint problem on Travis. (#2744) * fix: Range.js "event" is undeclared (#2749) * fix(timeline): #2720 Problems with option editable (#2743) Clean up and centralise edit status for Timeline Items. * feat(network): Improve the performance of the network layout engine (#2729) * Improve the performance of the network layout engine Short-cut the execution of a number of methods in LayoutEngine to make them handle highly-connected graphs better. * Demonstrations of layouts of large networks * Added support to supply an end to bar charts to have them scale (#2760) * Added support to supply an X2 to bar charts to have them scale * Fixed graph2d stacking issue. It no longer takes into account hidden items * Changed x2 to end per recommendation and added this to the docs * Initial tests for timeline ItemSet. (#2750) Somewhat more complicated setup, associated with the need for a real window. * [Timeline] Modify redraw logic to treat scroll as needing restack. (#2774) This addresses #1982 and #1417. It possibly reduces performance, but correctness seems better. * fix(timeline): #2672 Item events original event (#2704) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix events returned from mouse events * Fix example * Rename censor to stringifyObject in example * [timeline] Update examples to use ISOString format. (#2791) Resolves #2790 * [timeline] Update serialization example to use ISOString dates. (#2789) Resolves #2696 * added github templates for issues and pull-requests (#2787) fixes #2418 * feat(timeline): Add item data as argument to the template function (#2799) * Fix regression introduced in #2743. (#2796) * Fix for issue #2536 (#2803) * Fix for issue #2536 * Adjusted documentation for fix. * Adjustments due to review * Grrrrr whitespace * Fixed Travis issue * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * Update to gitignore to reflect changes on remote * clean dist folder * Local gitignore update * Just a first example file for the week scale feature * Allowing sourcemap creation * Initial (non-functional) commit to ensure we insert code at the right places (check TODOs) * Functional, not bug-free version which works with locale aware week numbers. * Locale-aware implementation and simplified major labels to a full year * Trying to make the major labels show the correct start date * Working implementation of week numbers using localization. * removing development leftovers * Updated package.json * Reintagrate package.json from accidental deletion * Updates for package.json * Fixing package.json * Integrate the week numbers feature in the documentation. * Reverting local changes to .gitignore * Reverting local changes * Extending examples to cover the case when 1st day of week and 1st day of month align; Fixing display bug so that week numbers are not repeated in minorLabels * Putting the examples into a loop
7 years ago
Implementation of a week scale feature (#3009) * Add Gitter badge (#2179) * do not generate source-maps in distribution version * add 'dist' folder for deployment * added Badges * added codeclimate badge * added @Tooa to the support team * added badges from isitmaintained.com (#2517) * do not ignore dist and test folders in master * generated dist files for v4.18.0 * generated dist files for v4.18.1 * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * changed to v4.18.1-SNAPSHOT * chore(docs): general improvements (#2652) * removed NOTICE file * updated license date range to include 2017 * chore(docs): updated support team members * chore: updated dependencies and devDependencies (#2649) * Fixes instanceof Object statements for objects from other windows and iFrames. (#2631) * Replaces instanceof Object checks with typeof to prevent cross tab issues. * Adds missing space. * chore: removed google-analytics from all examples (#2670) * chore(docs): Add note that PRs should be submitted against the `develop` branch (#2623) Related to: https://github.com/almende/vis/pull/2618 Related to: https://github.com/almende/vis/pull/2620 * feat(timeline): Change setCustomTimeTitle title parameter to be a string or a function (#2611) * change setCustomTimeTitle title parameter, Now could be an string or a function * Fixed indent and spacing * feat(timeline): refactor tooltip to only use one dom-element (#2662) * feat(network): Allow for image nodes to have a selected or broken image (#2601) * feat(tests): run mocha tests in travis ci (#2687) * Added showX(YZ)Axis options to Graph3d (#2686) * Added showX(YZ)Axis to Graph3d * Added show_Axis options to docs and playground example * Resolved merge conflict * Added show_Axis options to docs and playground example * fix(build): use babel version compatible with webpack@1.14 (#2693) fixes #2685 * feat(docs): use babel preset2015 for custom builds (#2678) * add link to a mentioned example (#2709) * chore(lint): added support for eslint (#2695) * Trivial typo fix in how_to_help doc. (#2714) * fix(timeline): #2598 Flickering onUpdateTimeTooltip (#2702) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add animation to onUpdateTooltip * fix(timeline): #778 Tooltip does not work with background items in timeline (#2703) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Make items z-index default to 1 * Add initial tests for Timeline PointItem (#2716) * fix(timeline): #2679 TypeError: Cannot read property 'hasOwnProperty' of null (#2735) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix bug in item editable * feat(timeline): #2647 Dynamic rolling mode option (#2705) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Add toggleRollingMode option * Update docs with toggleRollingMode option * fixes timestep next issue (#2732) * feat(timeline): added new locales for french and espanol (#2723) * Fix eslint problem on Travis. (#2744) * fix: Range.js "event" is undeclared (#2749) * fix(timeline): #2720 Problems with option editable (#2743) Clean up and centralise edit status for Timeline Items. * feat(network): Improve the performance of the network layout engine (#2729) * Improve the performance of the network layout engine Short-cut the execution of a number of methods in LayoutEngine to make them handle highly-connected graphs better. * Demonstrations of layouts of large networks * Added support to supply an end to bar charts to have them scale (#2760) * Added support to supply an X2 to bar charts to have them scale * Fixed graph2d stacking issue. It no longer takes into account hidden items * Changed x2 to end per recommendation and added this to the docs * Initial tests for timeline ItemSet. (#2750) Somewhat more complicated setup, associated with the need for a real window. * [Timeline] Modify redraw logic to treat scroll as needing restack. (#2774) This addresses #1982 and #1417. It possibly reduces performance, but correctness seems better. * fix(timeline): #2672 Item events original event (#2704) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * Fix events returned from mouse events * Fix example * Rename censor to stringifyObject in example * [timeline] Update examples to use ISOString format. (#2791) Resolves #2790 * [timeline] Update serialization example to use ISOString dates. (#2789) Resolves #2696 * added github templates for issues and pull-requests (#2787) fixes #2418 * feat(timeline): Add item data as argument to the template function (#2799) * Fix regression introduced in #2743. (#2796) * Fix for issue #2536 (#2803) * Fix for issue #2536 * Adjusted documentation for fix. * Adjustments due to review * Grrrrr whitespace * Fixed Travis issue * Cheap fix for bug #2795 * Update to PR #2826 to use newline format * Update to gitignore to reflect changes on remote * clean dist folder * Local gitignore update * Just a first example file for the week scale feature * Allowing sourcemap creation * Initial (non-functional) commit to ensure we insert code at the right places (check TODOs) * Functional, not bug-free version which works with locale aware week numbers. * Locale-aware implementation and simplified major labels to a full year * Trying to make the major labels show the correct start date * Working implementation of week numbers using localization. * removing development leftovers * Updated package.json * Reintagrate package.json from accidental deletion * Updates for package.json * Fixing package.json * Integrate the week numbers feature in the documentation. * Reverting local changes to .gitignore * Reverting local changes * Extending examples to cover the case when 1st day of week and 1st day of month align; Fixing display bug so that week numbers are not repeated in minorLabels * Putting the examples into a loop
7 years ago
  1. <?js
  2. var self = this;
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="en"><head>
  6. <meta charset="utf-8">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <meta name="description" content="">
  10. <meta name="author" content="">
  11. <link rel="icon" HREF="favicon.ico">
  12. <title>timeline - vis.js - A dynamic, browser based visualization library.</title>
  13. <!-- Bootstrap core CSS -->
  14. <link href="../css/bootstrap.css" rel="stylesheet">
  15. <!-- Tipue vendor css -->
  16. <link href="../css/tipuesearch.css" rel="stylesheet">
  17. <link href="../css/style.css" rel="stylesheet">
  18. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  19. <!--[if lt IE 9]>
  20. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  21. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  22. <![endif]-->
  23. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  24. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  25. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  26. <script src="../js/smooth-scroll.min.js"></script>
  27. <script language="JavaScript">
  28. smoothScroll.init();
  29. </script>
  30. <!-- Tipue vendor css -->
  31. <link href="../css/tipuesearch.css" rel="stylesheet">
  32. <!-- Tipue vendor css -->
  33. <link href="../css/tipuesearch.css" rel="stylesheet">
  34. <script type="text/javascript" src="../js/toggleTable.js"></script>
  35. </head>
  36. <body onload="prettyPrint();">
  37. <?js= self.partial('tmpl/navbar.tmpl') ?>
  38. <div class="container full">
  39. <h1>Timeline</h1>
  40. <h2 id="Overview">Overview</h2>
  41. <p>
  42. The Timeline is an interactive visualization chart to visualize data in time.
  43. The data items can take place on a single date, or have a start and end date (a range).
  44. You can freely move and zoom in the timeline by dragging and scrolling in the
  45. Timeline. Items can be created, edited, and deleted in the timeline.
  46. The time scale on the axis is adjusted automatically, and supports scales ranging
  47. from milliseconds to years.
  48. </p>
  49. <p>
  50. Timeline uses regular HTML DOM to render the timeline and items put on the
  51. timeline. This allows for flexible customization using css styling.
  52. </p>
  53. <h2 id="Contents">Contents</h2>
  54. <ul>
  55. <li><a href="#Overview">Overview</a></li>
  56. <li><a href="#Example">Example</a></li>
  57. <li><a href="#Loading">Loading</a></li>
  58. <li><a href="#Data_Format">Data Format</a>
  59. <ul>
  60. <li><a href="#items">Items</a></li>
  61. <li><a href="#groups">Groups</a></li>
  62. </ul>
  63. </li>
  64. <li><a href="#Configuration_Options">Configuration Options</a></li>
  65. <li><a href="#Methods">Methods</a></li>
  66. <li><a href="#Events">Events</a></li>
  67. <li><a href="#Editing_Items">Editing Items</a></li>
  68. <li><a href="#Templates">Templates</a></li>
  69. <li><a href="#Localization">Localization</a></li>
  70. <li><a href="#Time_zone">Time zone</a></li>
  71. <li><a href="#Styles">Styles</a></li>
  72. </ul>
  73. <h2 id="Example">Example</h2>
  74. <p>
  75. The following code shows how to create a Timeline and provide it with data.
  76. More examples can be found in the <a href="../../timeline_examples.html">timeline examples</a> page.
  77. </p>
  78. <pre class="prettyprint lang-html">&lt;!DOCTYPE HTML&gt;
  79. &lt;html&gt;
  80. &lt;head&gt;
  81. &lt;title&gt;Timeline | Basic demo&lt;/title&gt;
  82. &lt;style type="text/css"&gt;
  83. body, html {
  84. font-family: sans-serif;
  85. }
  86. &lt;/style&gt;
  87. &lt;script src="../../dist/vis.js"&gt;&lt;/script&gt;
  88. &lt;link href="../../dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  89. &lt;/head&gt;
  90. &lt;body&gt;
  91. &lt;div id="visualization"&gt;&lt;/div&gt;
  92. &lt;script type="text/javascript"&gt;
  93. // DOM element where the Timeline will be attached
  94. var container = document.getElementById('visualization');
  95. // Create a DataSet (allows two way data-binding)
  96. var items = new vis.DataSet([
  97. {id: 1, content: 'item 1', start: '2013-04-20'},
  98. {id: 2, content: 'item 2', start: '2013-04-14'},
  99. {id: 3, content: 'item 3', start: '2013-04-18'},
  100. {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
  101. {id: 5, content: 'item 5', start: '2013-04-25'},
  102. {id: 6, content: 'item 6', start: '2013-04-27'}
  103. ]);
  104. // Configuration for the Timeline
  105. var options = {};
  106. // Create a Timeline
  107. var timeline = new vis.Timeline(container, items, options);
  108. &lt;/script&gt;
  109. &lt;/body&gt;
  110. &lt;/html&gt;
  111. </pre>
  112. <h2 id="Loading">Loading</h2>
  113. <p>
  114. Install or download the <a href="http://visjs.org" target="_blank">vis.js</a> library
  115. in a subfolder of your project. Include the library's script and css files in the
  116. head of your html code:
  117. </p>
  118. <pre class="prettyprint lang-html">
  119. &lt;script src="vis/dist/vis.js"&gt;&lt;/script&gt;
  120. &lt;link href="vis/dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  121. </pre>
  122. The constructor of the Timeline is <code>vis.Timeline</code>
  123. <pre class="prettyprint lang-js">var timeline = new vis.Timeline(container, items, options);</pre>
  124. or when using groups:
  125. <pre class="prettyprint lang-js">var timeline = new vis.Timeline(container, items, groups, options);</pre>
  126. The constructor accepts four parameters:
  127. <ul>
  128. <li>
  129. <code>container</code> is the DOM element in which to create the timeline.
  130. </li>
  131. <li>
  132. <code>items</code> is an Array containing items. The properties of an
  133. item are described in section <a href="#Data_Format">Data Format, items</a>.
  134. </li><li>
  135. <code>groups</code> is an Array containing groups. The properties of a
  136. group are described in section <a href="#groups">Data Format, groups</a>.
  137. </li>
  138. <li>
  139. <code>options</code> is an optional Object containing a name-value map
  140. with options. Options can also be set using the method
  141. <code>setOptions</code>.
  142. </li>
  143. </ul>
  144. <h2 id="Data_Format">Data Format</h2>
  145. <p>
  146. The timeline can be provided with two types of data:
  147. </p>
  148. <ul>
  149. <li><a href="#items">Items</a> containing a set of items to be displayed in time.</li>
  150. <li><a href="#groups">Groups</a> containing a set of groups used to group items
  151. together.</li>
  152. </ul>
  153. <h3 id="items">Items</h3>
  154. <p>
  155. For items, the Timeline accepts an Array, a DataSet (offering 2 way data binding),
  156. or a DataView (offering 1 way data binding).
  157. Items are regular objects and can contain the properties <code>start</code>,
  158. <code>end</code> (optional), <code>content</code>,
  159. <code>group</code> (optional), <code>className</code> (optional),
  160. <code>editable</code> (optional), and <code>style</code> (optional).
  161. </p>
  162. <p>
  163. A DataSet is constructed as:
  164. </p>
  165. <pre class="prettyprint lang-js">
  166. var items = new vis.DataSet([
  167. {
  168. start: new Date(2010, 7, 15),
  169. end: new Date(2010, 8, 2), // end is optional
  170. content: 'Trajectory A'
  171. // Optional: fields 'id', 'type', 'group', 'className', 'style'
  172. }
  173. // more items...
  174. ]);
  175. </pre>
  176. <p>
  177. The item properties are defined as:
  178. </p>
  179. <table class="properties" id="itemOptionTable">
  180. <tr>
  181. <th>Name</th>
  182. <th>Type</th>
  183. <th>Required</th>
  184. <th>Description</th>
  185. </tr>
  186. <tr>
  187. <td>className</td>
  188. <td>String</td>
  189. <td>no</td>
  190. <td>This field is optional. A className can be used to give items
  191. an individual css style. For example, when an item has className
  192. 'red', one can define a css style like:
  193. <pre class="prettyprint lang-css">
  194. .vis-item.red {
  195. color: white;
  196. background-color: red;
  197. border-color: darkred;
  198. }</pre>
  199. More details on how to style items can be found in the section
  200. <a href="#Styles">Styles</a>.
  201. </td>
  202. </tr>
  203. <tr>
  204. <td>align</td>
  205. <td>String</td>
  206. <td>no</td>
  207. <td>This field is optional. If set this overrides the global <code>align</code> configuration option for this item.
  208. </td>
  209. </tr>
  210. <tr>
  211. <td>content</td>
  212. <td>String</td>
  213. <td>yes</td>
  214. <td>The contents of the item. This can be plain text or html code.</td>
  215. </tr>
  216. <tr>
  217. <td>end</td>
  218. <td>Date or number or string or Moment</td>
  219. <td>no</td>
  220. <td>The end date of the item. The end date is optional, and can be left <code>null</code>.
  221. If end date is provided, the item is displayed as a range.
  222. If not, the item is displayed as a box.</td>
  223. </tr>
  224. <tr>
  225. <td>group</td>
  226. <td>any type</td>
  227. <td>no</td>
  228. <td>This field is optional. When the group column is provided,
  229. all items with the same group are placed on one line.
  230. A vertical axis is displayed showing the groups.
  231. Grouping items can be useful for example when showing availability of multiple
  232. people, rooms, or other resources next to each other.<br>
  233. </td>
  234. </tr>
  235. <tr>
  236. <td>id</td>
  237. <td>String or Number</td>
  238. <td>no</td>
  239. <td>An id for the item. Using an id is not required but highly
  240. recommended. An id is needed when dynamically adding, updating,
  241. and removing items in a DataSet.</td>
  242. </tr>
  243. <tr>
  244. <td>start</td>
  245. <td>Date or number or string or Moment</td>
  246. <td>yes</td>
  247. <td>The start date of the item, for example <code>new Date(2010,9,23)</code>.</td>
  248. </tr>
  249. <tr>
  250. <td>style</td>
  251. <td>String</td>
  252. <td>no</td>
  253. <td>
  254. A css text string to apply custom styling for an individual item, for
  255. example <code>"color: red; background-color: pink;"</code>.
  256. </td>
  257. </tr>
  258. <tr>
  259. <td>subgroup</td>
  260. <td>String or Number</td>
  261. <td>none</td>
  262. <td>The id of a subgroup.
  263. Groups all items within a group per subgroup, and positions them on the
  264. same height instead of staking them on top of each other. can be ordered
  265. by specifying the option <code>subgroupOrder</code> of a group.
  266. </td>
  267. </tr>
  268. <tr>
  269. <td>title</td>
  270. <td>String</td>
  271. <td>none</td>
  272. <td>Add a title for the item, displayed when holding the mouse on the item.
  273. The title can be an HTML element or a string containing plain text or HTML.
  274. </td>
  275. </tr>
  276. <tr>
  277. <td>type</td>
  278. <td>String</td>
  279. <td>no</td>
  280. <td>The type of the item. Can be 'box' (default), 'point', 'range', or 'background'.
  281. Types 'box' and 'point' need a start date, the types 'range' and 'background' needs both a start and end date.
  282. </td>
  283. </tr>
  284. <tr>
  285. <td>limitSize</td>
  286. <td>Boolean</td>
  287. <td>no</td>
  288. <td>Some browsers cannot handle very large DIVs so by default range DIVs can be truncated outside the visible area.
  289. Setting this to <code>false</code> will cause the creation of full-size DIVs.
  290. </td>
  291. </tr>
  292. <tr class='toggle collapsible' onclick="toggleTable('itemOptionTable', 'itemEditable', this);">
  293. <td><span parent="itemEditable" class="right-caret"></span> editable</td>
  294. <td>Boolean or Object</td>
  295. <td>no</td>
  296. <td>Override the editable option of the timeline for a specific item (assuming <code>timeline.editable.overrideItems</code> is false).</td>
  297. </tr>
  298. <tr parent="itemEditable" class="hidden">
  299. <td class="indent">editable.remove</td>
  300. <td>boolean</td>
  301. <td>no</td>
  302. <td>If true, item can be deleted by first selecting it, and then clicking the delete button on the top right of the item. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  303. </tr>
  304. <tr parent="itemEditable" class="hidden">
  305. <td class="indent">editable.updateGroup</td>
  306. <td>boolean</td>
  307. <td>no</td>
  308. <td>If true, item can be dragged from one group to another. Only applicable when the Timeline has groups. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  309. </tr>
  310. <tr parent="itemEditable" class="hidden">
  311. <td class="indent">editable.updateTime</td>
  312. <td>boolean</td>
  313. <td>no</td>
  314. <td>If true, items can be dragged to another moment in time. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  315. </tr>
  316. </table>
  317. <h3 id="groups">Groups</h3>
  318. <p>
  319. For the items, groups can be an Array, a DataSet (offering 2 way data binding),
  320. or a DataView (offering 1 way data binding).
  321. Using groups, items can be grouped together.
  322. Items are filtered per group, and displayed as
  323. Group items can contain the properties <code>id</code>,
  324. <code>content</code>, and <code>className</code> (optional).
  325. </p>
  326. <p>
  327. Groups can be applied to a timeline using the method <code>setGroups</code> or supplied in the constructor.
  328. A table with groups can be created like:
  329. </p>
  330. <pre class="prettyprint lang-js">
  331. var groups = [
  332. {
  333. id: 1,
  334. content: 'Group 1'
  335. // Optional: a field 'className', 'style', 'order', [properties]
  336. }
  337. // more groups...
  338. ]);
  339. </pre>
  340. <p>
  341. Groups can have the following properties:
  342. </p>
  343. <table class="properties">
  344. <tr>
  345. <th>Name</th>
  346. <th>Type</th>
  347. <th>Required</th>
  348. <th>Description</th>
  349. </tr>
  350. <tr>
  351. <td>className</td>
  352. <td>String</td>
  353. <td>no</td>
  354. <td>This field is optional. A className can be used to give groups
  355. an individual css style. For example, when a group has className
  356. 'red', one can define a css style
  357. <code>
  358. .red {
  359. color: red;
  360. }
  361. </code>.
  362. More details on how to style groups can be found in the section
  363. <a href="#Styles">Styles</a>.
  364. </td>
  365. </tr>
  366. <tr>
  367. <td>content</td>
  368. <td>String or Element</td>
  369. <td>yes</td>
  370. <td>The contents of the group. This can be plain text, html code or an html element.</td>
  371. </tr>
  372. <tr>
  373. <td>id</td>
  374. <td>String or Number</td>
  375. <td>yes</td>
  376. <td>An id for the group. The group will display all items having a
  377. property <code>group</code> which matches the <code>id</code>
  378. of the group.</td>
  379. </tr>
  380. <tr>
  381. <td>style</td>
  382. <td>String</td>
  383. <td>no</td>
  384. <td>
  385. A css text string to apply custom styling for an individual group label, for
  386. example <code>"color: red; background-color: pink;"</code>.
  387. </td>
  388. </tr>
  389. <tr>
  390. <td>subgroupOrder</td>
  391. <td>String or Function</td>
  392. <td>none</td>
  393. <td>Order the subgroups by a field name or custom sort function.
  394. By default, groups are ordered by first-come, first-show.
  395. </td>
  396. </tr>
  397. <tr>
  398. <td>subgroupStack</td>
  399. <td>Object or Boolean</td>
  400. <td>none</td>
  401. <td>Enables stacking within individual subgroups. Example: <code>{'subgroup0': true, 'subgroup1': false, 'subgroup2': true}</code>
  402. For each subgroup where stacking is enabled, items will be stacked on top of each other within that subgroup such that they do no overlap.
  403. If set to <code>true</code> all subgroups will be stacked.
  404. If a value was specified for the <code>order</code> parameter in the options, that ordering will be used when stacking the items.
  405. </td>
  406. </tr>
  407. <tr>
  408. <td>title</td>
  409. <td>String</td>
  410. <td>none</td>
  411. <td>A title for the group, displayed when holding the mouse on the groups label.
  412. The title can only contain plain text.
  413. </td>
  414. </tr>
  415. <tr>
  416. <td>visible</td>
  417. <td>Boolean</td>
  418. <td>no</td>
  419. <td>Provides a means to toggle the whether a group is displayed or not. Defaults to <code>true</code>.</td>
  420. </tr>
  421. <tr>
  422. <td>nestedGroups</td>
  423. <td>Array</td>
  424. <td>no</td>
  425. <td>Array of group ids nested in the group. Nested groups will appear under this nesting group.</td>
  426. </tr>
  427. <tr>
  428. <td>showNested</td>
  429. <td>Boolean</td>
  430. <td>no</td>
  431. <td>Assuming the group has nested groups, this will set the initial state of the group - shown or collapsed. The <code>showNested</code> is defaulted to <code>true</code>.</td>
  432. </tr>
  433. <tr>
  434. <td>heightMode</td>
  435. <td>String</td>
  436. <td>no</td>
  437. <td>This field is optional. Can be 'auto' (default) or 'fixed'. If set this overrides the global <code>groupHeightMode</code> configuration option for this group.</td>
  438. </tr>
  439. </table>
  440. <h2 id="Configuration_Options">Configuration Options</h2>
  441. <p>
  442. Options can be used to customize the timeline.
  443. Options are defined as a JSON object. All options are optional.
  444. </p>
  445. <pre class="prettyprint lang-js">
  446. var options = {
  447. width: '100%',
  448. height: '30px',
  449. margin: {
  450. item: 20
  451. }
  452. };
  453. </pre>
  454. <p>
  455. The following options are available.
  456. </p>
  457. <table class="options" id="optionTable">
  458. <tr>
  459. <th>Name</th>
  460. <th>Type</th>
  461. <th>Default</th>
  462. <th>Description</th>
  463. </tr>
  464. <tr>
  465. <td>align</td>
  466. <td>String</td>
  467. <td><code>'center'</code></td>
  468. <td>Alignment of items with type 'box', 'range', and 'background'. Available values are 'auto' (default), 'center', 'left', or 'right'. For 'box' items, the 'auto' alignment is 'center'. For 'range' items, the auto alignment is dynamic: positioned left and shifted such that the contents is always visible on screen.</td>
  469. </tr>
  470. <tr>
  471. <td>alignCurrentTime</td>
  472. <td>String</td>
  473. <td>none</td>
  474. <td>If set, the current time bar will be aligned to the start of the chosen unit of time. Available values are 'year', 'month', 'quarter', 'week', 'isoWeek', 'day', 'date', 'hour', 'minute' or 'second'. If not provided, the current time bar will be updated at every tick.</td>
  475. </tr>
  476. <tr>
  477. <td>autoResize</td>
  478. <td>boolean</td>
  479. <td><code>true</code></td>
  480. <td>If true, the Timeline will automatically detect when its container is resized, and redraw itself accordingly. If false, the Timeline can be forced to repaint after its container has been resized using the function <code>redraw()</code>.</td>
  481. </tr>
  482. <tr>
  483. <td>clickToUse</td>
  484. <td>boolean</td>
  485. <td><code>false</code></td>
  486. <td>When a Timeline is configured to be <code>clickToUse</code>, it will react to mouse and touch events only when active.
  487. When active, a blue shadow border is displayed around the Timeline. The Timeline is set active by clicking on it, and is changed to inactive again by clicking outside the Timeline or by pressing the ESC key.</td>
  488. </tr>
  489. <tr>
  490. <td>configure</td>
  491. <td>boolean or function</td>
  492. <td><code>false</code></td>
  493. <td>When true, a configurator is loaded where all configuration options of the Timeline can be changed live.
  494. The displayed options can be filtered by providing a filter function. This function is invoked with two arguments: the current <code>option</code> and the <code>path</code> (an Array) of the option within the options object. The option will be displayed when the filter function returns true. For example to only display format options:
  495. <pre class="prettyprint lang-js">
  496. function (option, path) {
  497. return option === 'format' || path.indexOf('format') !== -1;
  498. }</pre>
  499. </td>
  500. </tr>
  501. <tr>
  502. <td>dataAttributes</td>
  503. <td>string[] or 'all'</string></td>
  504. <td><code>false</code></td>
  505. <td>An array of fields optionally defined on the timeline items that will be appended as <code>data-</code> attributes to the DOM element of the items.<br>
  506. If value is <code>'all'</code> then each field defined on the timeline item will become a <code>data-</code> attribute.</td>
  507. </tr>
  508. <tr class='toggle collapsible' onclick="toggleTable('optionTable','editable', this);">
  509. <td><span parent="editable" class="right-caret"></span> editable</td>
  510. <td>boolean or Object</td>
  511. <td><code>false</code></td>
  512. <td>If true, the items in the timeline can be manipulated. Only applicable when option <code>selectable</code> is <code>true</code>. See also the callbacks <code>onAdd</code>, <code>onUpdate</code>, <code>onMove</code>, and <code>onRemove</code>. When <code>editable</code> is an object, one can enable or disable individual manipulation actions.
  513. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.
  514. </td>
  515. </tr>
  516. <tr parent="editable" class="hidden">
  517. <td class="indent">editable.add</td>
  518. <td>boolean</td>
  519. <td><code>false</code></td>
  520. <td>If true, new items can be created by double tapping an empty space in the Timeline. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  521. </tr>
  522. <tr parent="editable" class="hidden">
  523. <td class="indent">editable.remove</td>
  524. <td>boolean</td>
  525. <td><code>false</code></td>
  526. <td>If true, items can be deleted by first selecting them, and then clicking the delete button on the top right of the item. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  527. </tr>
  528. <tr parent="editable" class="hidden">
  529. <td class="indent">editable.updateGroup</td>
  530. <td>boolean</td>
  531. <td><code>false</code></td>
  532. <td>If true, items can be dragged from one group to another. Only applicable when the Timeline has groups. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  533. </tr>
  534. <tr parent="editable" class="hidden">
  535. <td class="indent">editable.updateTime</td>
  536. <td>boolean</td>
  537. <td><code>false</code></td>
  538. <td>If true, items can be dragged to another moment in time. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  539. </tr>
  540. <tr parent="editable" class="hidden">
  541. <td class="indent">editable.overrideItems</td>
  542. <td>boolean</td>
  543. <td><code>false</code></td>
  544. <td>If true, item specific editable properties are overridden by timeline settings</td>
  545. </tr>
  546. <tr>
  547. <td>end</td>
  548. <td>Date or Number or String or Moment</td>
  549. <td>none</td>
  550. <td>The initial end date for the axis of the timeline.
  551. If not provided, the latest date present in the items set is taken as
  552. end date.</td>
  553. </tr>
  554. <tr>
  555. <td>format</td>
  556. <td>Object or Function</td>
  557. <td>none</td>
  558. <td>
  559. Apply custom date formatting of the labels on the time axis. The default value of <code>format</code> is:
  560. <pre class="prettyprint lang-js">{
  561. minorLabels: {
  562. millisecond:'SSS',
  563. second: 's',
  564. minute: 'HH:mm',
  565. hour: 'HH:mm',
  566. weekday: 'ddd D',
  567. day: 'D',
  568. week: 'w',
  569. month: 'MMM',
  570. quarter: '[Q]Q',
  571. year: 'YYYY'
  572. },
  573. majorLabels: {
  574. millisecond:'HH:mm:ss',
  575. second: 'D MMMM HH:mm',
  576. minute: 'ddd D MMMM',
  577. hour: 'ddd D MMMM',
  578. weekday: 'MMMM YYYY',
  579. day: 'MMMM YYYY',
  580. week: 'MMMM YYYY',
  581. month: 'YYYY',
  582. quarter: 'YYYY',
  583. year: ''
  584. }
  585. }</pre>
  586. For values which not provided in the customized <code>options.format</code>, the default values will be used.
  587. All available formatting syntax is described in the <a href="http://momentjs.com/docs/#/displaying/format/">docs of moment.js</a>.
  588. <br>
  589. You can also use a function format for each label. The function accepts as arguments the date, scale and step in that order, and expects to return a string for the label.
  590. <pre class="prettyprint lang-js">function format({
  591. minorLabels: Function(date: Date, scale: Number, step: Number),
  592. majorLabels: Function(date: Date, scale: Number, step: Number)
  593. }</pre>
  594. </td>
  595. </tr>
  596. <tr class='toggle collapsible' onclick="toggleTable('optionTable','groupEditable', this);">
  597. <td><span parent="groupEditable" class="right-caret"></span> groupEditable</td>
  598. <td>boolean or Object</td>
  599. <td><code>false</code></td>
  600. <td>If true, the groups in the timeline can be manipulated. See also the callbacks <code>onAddGroup</code>, <code>onMoveGroup</code>, and <code>onRemoveGroup</code>. When <code>groupEditable</code> is an object, one can enable or disable individual manipulation actions.
  601. The editing of groups follows the same principles as for items, see section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.
  602. </td>
  603. </tr>
  604. <tr parent="groupEditable" class="hidden">
  605. <td class="indent">groupEditable.add</td>
  606. <td>boolean</td>
  607. <td><code>false</code></td>
  608. <td>If true, new groups can be created in the Timeline. For now adding new groups is done by the user.</td>
  609. </tr>
  610. <tr parent="groupEditable" class="hidden">
  611. <td class="indent">groupEditable.remove</td>
  612. <td>boolean</td>
  613. <td><code>false</code></td>
  614. <td>If true, groups can be deleted. For now removing groups is done by the user.</td>
  615. </tr>
  616. <tr parent="groupEditable" class="hidden">
  617. <td class="indent">groupEditable.order</td>
  618. <td>boolean</td>
  619. <td><code>false</code></td>
  620. <td>If true, groups can be dragged to change their order. Only applicable when the Timeline has groups. For this option to work properly the groupOrder and groupOrderSwap options have to be set as well.</td>
  621. </tr>
  622. <tr>
  623. <td>groupHeightMode</td>
  624. <td>String</td>
  625. <td>'auto'</td>
  626. <td>Specifies how the height of a group is calculated. Choose from 'auto' and 'fixed'. If it is set to 'auto' the height will be calculated based on the visible items. While if it is set to 'fixed' the group will keep the same height even if there are no visible items in the window.</td>
  627. </tr>
  628. <tr>
  629. <td>groupLabelDirection</td>
  630. <td>String</td>
  631. <td>'horizontal'</td>
  632. <td>Set the text direction of group labels. The possible values are 'horizontal' and 'vertical'.</td>
  633. </tr>
  634. <tr>
  635. <td>groupOrder</td>
  636. <td>String or Function</td>
  637. <td>'order'</td>
  638. <td>Order the groups by a field name or custom sort function.
  639. By default, groups are ordered by a property <code>order</code> (if set).
  640. If no <code>order</code> properties are provided, the order will be undetermined.
  641. </td>
  642. </tr>
  643. <tr>
  644. <td>groupOrderSwap</td>
  645. <td>Function</td>
  646. <td>none</td>
  647. <td>Swaps the positions of two groups. If groups have a custom order (via <code>groupOrder</code>) and groups are configured to be reorderable (via <code>groupEditable.order</code>), the user has to provide a function that swaps the positions of two given groups.
  648. If this option is not set, the default implementation assumes that groups hold an attribute <code>order</code> which values are changed. The signature of the <code>groupOrderWap</code> function is:
  649. <pre class="prettyprint lang-js">function groupOrderSwap(fromGroup: Object, toGroup: Object, groups: DataSet)</pre>
  650. The first to arguments hold the groups of which the positions are to be swapped and the third argument holds the DataSet with all groups.
  651. </td>
  652. </tr>
  653. <tr>
  654. <td>groupTemplate</td>
  655. <td>function</td>
  656. <td>none</td>
  657. <td>A template function used to generate the contents of the groups. The function is called by the Timeline with a groups data as the first argument and the group element as the second, and must return HTML code, a string or a template as result. When the option groupTemplate is specified, the groups do not need to have a field <code>content</code>. See section <a href="#Templates">Templates</a> for a detailed explanation.</td>
  658. </tr>
  659. <tr>
  660. <td>height</td>
  661. <td>number or String</td>
  662. <td>none</td>
  663. <td>The height of the timeline in pixels or as a percentage.
  664. When height is undefined or null, the height of the timeline is automatically
  665. adjusted to fit the contents.
  666. It is possible to set a maximum height using option <code>maxHeight</code>
  667. to prevent the timeline from getting too high in case of automatically
  668. calculated height.
  669. </td>
  670. </tr>
  671. <tr>
  672. <td>hiddenDates</td>
  673. <td>Object</td>
  674. <td>none</td>
  675. <td>This option allows you to hide specific timespans from the time axis. The dates can be supplied as an object:
  676. <code>{start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00', [repeat:'daily']}</code> or as an Array of these objects. The repeat argument is optional.
  677. The possible values are (case-sensitive): <code>daily, weekly, monthly, yearly</code>. To hide a weekend, pick any Saturday as start and the following Monday as end
  678. and set repeat to weekly.
  679. </td>
  680. </tr>
  681. <tr>
  682. <td>horizontalScroll</td>
  683. <td>Boolean</td>
  684. <td>false</td>
  685. <td>This option allows you to scroll horizontally to move backwards and forwards in the time range.
  686. Only applicable when option <code>zoomCtrl</code> is defined or <code>zoomable</code> is <code>false</code>.
  687. </td>
  688. </tr>
  689. <tr class='toggle collapsible' onclick="toggleTable('optionTable','itemsAlwaysDraggable', this);">
  690. <td><span parent="itemsAlwaysDraggable" class="right-caret"></span> itemsAlwaysDraggable</td>
  691. <td>boolean or Object</td>
  692. <td>Object</td>
  693. <td>When a boolean, applies the value only to <code>itemsAlwaysDraggable.item</code>.</td>
  694. </tr>
  695. <tr parent="itemsAlwaysDraggable" class="hidden">
  696. <td class="indent">itemsAlwaysDraggable.item</td>
  697. <td>boolean</td>
  698. <td><code>false</code></td>
  699. <td>If true, all items in the Timeline are draggable without being selected. If false, only the selected item(s) are draggable.</td>
  700. </tr>
  701. <tr parent="itemsAlwaysDraggable" class="hidden">
  702. <td class="indent">itemsAlwaysDraggable.range</td>
  703. <td>boolean</td>
  704. <td><code>false</code></td>
  705. <td>If true, range of all items in the Timeline is draggable without being selected. If false, range is only draggable for the selected item(s). Only applicable when option <code>itemsAlwaysDraggable.item</code> is set <code>true</code>. </td>
  706. </tr>
  707. <tr>
  708. <td>loadingScreenTemplate</td>
  709. <td>function</td>
  710. <td>none</td>
  711. <td>A template function used to generate the timeline initial loading screen. See section <a href="#Templates">Templates</a> for a detailed explanation.</td>
  712. </tr>
  713. <tr>
  714. <td>locale</td>
  715. <td>String</td>
  716. <td>none</td>
  717. <td>Select a locale for the Timeline. See section <a href="#Localization">Localization</a> for more information.</td>
  718. </tr>
  719. <tr>
  720. <td>locales</td>
  721. <td>Object</td>
  722. <td>none</td>
  723. <td>A map with i18n locales. See section <a href="#Localization">Localization</a> for more information.</td>
  724. </tr>
  725. <tr>
  726. <td>moment</td>
  727. <td>function</td>
  728. <td>vis.moment</td>
  729. <td>A constructor for creating a moment.js Date. Allows for applying a custom time zone. See section <a href="#Time_zone">Time zone</a> for more information.</td>
  730. </tr>
  731. <tr class='toggle collapsible' onclick="toggleTable('optionTable','margin', this);">
  732. <td><span parent="margin" class="right-caret"></span> margin</td>
  733. <td>number or Object</td>
  734. <td>Object</td>
  735. <td>When a number, applies the margin to <code>margin.axis</code>, <code>margin.item.horizontal</code>, and <code>margin.item.vertical</code>.</td>
  736. </tr>
  737. <tr parent="margin" class="hidden">
  738. <td class="indent">margin.axis</td>
  739. <td>number</td>
  740. <td><code>20</code></td>
  741. <td>The minimal margin in pixels between items and the time axis.</td>
  742. </tr>
  743. <tr parent="margin" class="hidden">
  744. <td class="indent">margin.item</td>
  745. <td>number</td>
  746. <td><code>10</code></td>
  747. <td>The minimal margin in pixels between items in both horizontal and vertical direction.</td>
  748. </tr>
  749. <tr parent="margin" class="hidden">
  750. <td class="indent2">margin.item.horizontal</td>
  751. <td>number</td>
  752. <td><code>10</code></td>
  753. <td>The minimal horizontal margin in pixels between items.</td>
  754. </tr>
  755. <tr parent="margin" class="hidden">
  756. <td class="indent2">margin.item.vertical</td>
  757. <td>number</td>
  758. <td><code>10</code></td>
  759. <td>The minimal vertical margin in pixels between items.</td>
  760. </tr>
  761. <tr>
  762. <td>max</td>
  763. <td>Date or Number or String or Moment</td>
  764. <td>none</td>
  765. <td>Set a maximum Date for the visible range.
  766. It will not be possible to move beyond this maximum.
  767. </td>
  768. </tr>
  769. <tr>
  770. <td>maxHeight</td>
  771. <td>number or String</td>
  772. <td>none</td>
  773. <td>Specifies the maximum height for the Timeline. Can be a number in pixels or a string like "300px".</td>
  774. </tr>
  775. <tr>
  776. <td>maxMinorChars</td>
  777. <td>number</td>
  778. <td>7</td>
  779. <td>
  780. Specifies the maximum number of characters that should fit in minor grid labels.
  781. If larger, less and wider grids will be drawn.
  782. </td>
  783. </tr>
  784. <tr>
  785. <td>min</td>
  786. <td>Date or Number or String or Moment</td>
  787. <td>none</td>
  788. <td>Set a minimum Date for the visible range.
  789. It will not be possible to move beyond this minimum.
  790. </td>
  791. </tr>
  792. <tr>
  793. <td>minHeight</td>
  794. <td>number or String</td>
  795. <td>none</td>
  796. <td>Specifies the minimum height for the Timeline. Can be a number in pixels or a string like "300px".</td>
  797. </tr>
  798. <tr>
  799. <td>moveable</td>
  800. <td>boolean</td>
  801. <td><code>true</code></td>
  802. <td>
  803. Specifies whether the Timeline can be moved and zoomed by dragging the window.
  804. See also option <code>zoomable</code>.
  805. </td>
  806. </tr>
  807. <tr>
  808. <td>multiselect</td>
  809. <td>boolean</td>
  810. <td><code>false</code></td>
  811. <td>
  812. If true, multiple items can be selected using ctrl+click, shift+click, or by holding items.
  813. Only applicable when option <code>selectable</code> is <code>true</code>.
  814. </td>
  815. </tr>
  816. <tr>
  817. <td style="font-size: 0.9em">multiselectPerGroup</td>
  818. <td>boolean</td>
  819. <td><code>false</code></td>
  820. <td>
  821. If true, selecting multiple items using shift+click will only select items residing in the same group as the <i>first</i> selected item.
  822. Only applicable when option <code>selectable</code> and <code>multiselect</code> are <code>true</code>.
  823. </td>
  824. </tr>
  825. <tr>
  826. <td>onAdd</td>
  827. <td>function</td>
  828. <td>none</td>
  829. <td>Callback function triggered when an item is about to be added: when the user double taps an empty space in the Timeline. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.add</code> are set <code>true</code>.
  830. </td>
  831. </tr>
  832. <tr>
  833. <td>onAddGroup</td>
  834. <td>function</td>
  835. <td>none</td>
  836. <td>Callback function triggered when a group is about to be added. The signature and semantics are the same as for <code>onAdd</code>.
  837. </td>
  838. </tr>
  839. <tr>
  840. <td>onDropObjectOnItem</td>
  841. <td>function</td>
  842. <td>none</td>
  843. <td>Callback function triggered when an object containing <code>target:'item'</code> in its drag data is dropped in to a timeline item.
  844. </td>
  845. </tr>
  846. <tr>
  847. <td>onInitialDrawComplete</td>
  848. <td>function</td>
  849. <td>none</td>
  850. <td>Callback function triggered when the timeline is initially drawn. This function fires once per timeline creation.
  851. </td>
  852. </tr>
  853. <tr>
  854. <td>onMove</td>
  855. <td>function</td>
  856. <td>none</td>
  857. <td>Callback function triggered when an item has been moved: after the user has dragged the item to an other position. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.updateTime</code> or <code>editable.updateGroup</code> are set <code>true</code>.
  858. </td>
  859. </tr>
  860. <tr>
  861. <td>onMoveGroup</td>
  862. <td>function</td>
  863. <td>none</td>
  864. <td>Callback function triggered when a group has been moved: after the user has dragged the group to an other position. The signature and semantics are the same as for <code>onMove</code>.
  865. </td>
  866. </tr>
  867. <tr>
  868. <td>onMoving</td>
  869. <td>function</td>
  870. <td>none</td>
  871. <td>Callback function triggered repeatedly when an item is being moved. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.updateTime</code> or <code>editable.updateGroup</code> are set <code>true</code>.
  872. </td>
  873. </tr>
  874. <tr>
  875. <td>onRemove</td>
  876. <td>function</td>
  877. <td>none</td>
  878. <td>Callback function triggered when an item is about to be removed: when the user tapped the delete button on the top right of a selected item. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.remove</code> are set <code>true</code>.
  879. </td>
  880. </tr>
  881. <tr>
  882. <td>onRemoveGroup</td>
  883. <td>function</td>
  884. <td>none</td>
  885. <td>Callback function triggered when a group is about to be removed. The signature and semantics are the same as for <code>onRemove</code>.
  886. </td>
  887. </tr>
  888. <tr class='toggle collapsible' onclick="toggleTable('optionTable','onTimeout', this);">
  889. <td><span parent="onTimeout" class="right-caret"></span> onTimeout</td>
  890. <td>Object</td>
  891. <td><code>Object</code></td>
  892. <td>Specify timeline bailing options when a specified timeout is reached.</td>
  893. </tr>
  894. <tr parent="onTimeout" class="hidden">
  895. <td class="indent">onTimeout.timeoutMs</td>
  896. <td>number</td>
  897. <td>none</td>
  898. <td>Number of milliseconds until the callback function should be called.
  899. The callback will not be called if the timeline gets drawn completely before the timeoutMs limit.</td>
  900. </tr>
  901. <tr parent="onTimeout" class="hidden">
  902. <td class="indent">onTimeout.callback</td>
  903. <td>function</td>
  904. <td>none</td>
  905. <td>
  906. A callback function called when <code>timeoutMs</code> milliseconds pass and the timeline has yet to be fully drawn initially.
  907. </td>
  908. </tr>
  909. <tr>
  910. <td>onUpdate</td>
  911. <td>function</td>
  912. <td>none</td>
  913. <td>Callback function triggered when an item is about to be updated, when the user double taps an item in the Timeline. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.updateTime</code> or <code>editable.updateGroup</code> are set <code>true</code>.
  914. </td>
  915. </tr>
  916. <tr>
  917. <td>order</td>
  918. <td>function</td>
  919. <td>none</td>
  920. <td>
  921. <p>Provide a custom sort function to order the items. The order of the
  922. items is determining the way they are stacked. The function
  923. order is called with two arguments containing the data of two items to be
  924. compared.
  925. </p>
  926. <p style="font-style: italic">WARNING: Use with caution. Custom ordering is not suitable for large amounts of items. On load, the Timeline will render all items once to determine their width and height. Keep the number of items in this configuration limited to a maximum of a few hundred items.</p>
  927. </td>
  928. </tr>
  929. <tr class='toggle collapsible' onclick="toggleTable('optionTable','orientation', this);">
  930. <td><span parent="orientation" class="right-caret"></span> orientation</td>
  931. <td>String or Object</td>
  932. <td><code>'bottom'</code></td>
  933. <td>Orientation of the timelines axis and items. When orientation is a string, the value is applied to both items and axis. Can be 'top', 'bottom' (default), 'both', or 'none'.</td>
  934. </tr>
  935. <tr parent="orientation" class="hidden">
  936. <td class="indent">orientation.axis</td>
  937. <td>String</td>
  938. <td><code>'bottom'</code></td>
  939. <td>Orientation of the timeline axis: 'top', 'bottom' (default), 'both', or 'none'. If orientation is 'bottom', the time axis is drawn at the bottom. When 'top', the axis is drawn on top. When 'both', two axes are drawn, both on top and at the bottom. In case of 'none', no axis is drawn at all.</td>
  940. </tr>
  941. <tr parent="orientation" class="hidden">
  942. <td class="indent">orientation.item</td>
  943. <td>String</td>
  944. <td><code>'bottom'</code></td>
  945. <td>Orientation of the timeline items: 'top' or 'bottom' (default). Determines whether items are aligned to the top or bottom of the Timeline.</td>
  946. </tr>
  947. <tr class='toggle collapsible' onclick="toggleTable('optionTable','rollingMode', this);">
  948. <td><span parent="rollingMode" class="right-caret"></span> rollingMode</td>
  949. <td>Object</td>
  950. <td><code>Object</code></td>
  951. <td>Specify how the timeline implements rolling mode.</td>
  952. </tr>
  953. <tr parent="rollingMode" class="hidden">
  954. <td class="indent">rollingMode.follow</td>
  955. <td>boolean</td>
  956. <td><code>false</code></td>
  957. <td>If true, the timeline will initial in a rolling mode - the current time will always be centered. I the user drags the timeline, the timeline will go out of rolling mode and a toggle button will appear. Clicking that button will go back to rolling mode. Zooming in rolling mode will zoom in to the center without consideration of the mouse position.</td>
  958. </tr>
  959. <tr parent="rollingMode" class="hidden">
  960. <td class="indent">rollingMode.offset</td>
  961. <td>Number</td>
  962. <td><code>'0.5'</code></td>
  963. <td>
  964. Set how far from the left the rolling mode is implemented from. A percentage (i.e. a decimal between 0 and 1)
  965. Defaults to the middle or 0.5 (50%)
  966. </td>
  967. </tr>
  968. <tr>
  969. <td>rtl</td>
  970. <td>boolean</td>
  971. <td><code>false</code></td>
  972. <td>If true, the timeline will be right-to-left. Note: you can achieve rtl timeline by defining a parent node with <code>dir="rtl"</code>. The timeline knows to take the nearest parent node direction and apply it. Notice that the timeline will prefer the <code>option.rtl</code> over any parent <code>dir="rtl"</code></td>
  973. </tr>
  974. <tr>
  975. <td>selectable</td>
  976. <td>boolean</td>
  977. <td><code>true</code></td>
  978. <td>If true, the items on the timeline can be selected. Multiple items can be selected by long pressing them, or by using ctrl+click or shift+click. The event <code>select</code> is fired each time the selection has changed (see section <a href="#Events">Events</a>).</td>
  979. </tr>
  980. <tr>
  981. <td>showCurrentTime</td>
  982. <td>boolean</td>
  983. <td><code>true</code></td>
  984. <td>Show a vertical bar at the current time.</td>
  985. </tr>
  986. <tr>
  987. <tr>
  988. <td>showMajorLabels</td>
  989. <td>boolean</td>
  990. <td><code>true</code></td>
  991. <td>By default, the timeline shows both minor and major date labels on the
  992. time axis.
  993. For example the minor labels show minutes and the major labels show hours.
  994. When <code>showMajorLabels</code> is <code>false</code>, no major labels
  995. are shown.</td>
  996. </tr>
  997. <tr>
  998. <td>showMinorLabels</td>
  999. <td>boolean</td>
  1000. <td><code>true</code></td>
  1001. <td>By default, the timeline shows both minor and major date labels on the
  1002. time axis.
  1003. For example the minor labels show minutes and the major labels show hours.
  1004. When <code>showMinorLabels</code> is <code>false</code>, no minor labels
  1005. are shown. When both <code>showMajorLabels</code> and
  1006. <code>showMinorLabels</code> are false, no horizontal axis will be
  1007. visible.</td>
  1008. </tr>
  1009. <tr>
  1010. <td>showTooltips</td>
  1011. <td>boolean</td>
  1012. <td><code>true</code></td>
  1013. <td>If true, items with titles will display a tooltip. If false, item tooltips are prevented from showing.</td>
  1014. </tr>
  1015. <tr>
  1016. <td>stack</td>
  1017. <td>boolean</td>
  1018. <td><code>true</code></td>
  1019. <td>If true (default), items will be stacked on top of each other such that they do not overlap.</td>
  1020. </tr>
  1021. <tr>
  1022. <td>stackSubgroups</td>
  1023. <td>boolean</td>
  1024. <td><code>true</code></td>
  1025. <td>If true (default), subgroups will be stacked on top of each other such that they do not overlap.</td>
  1026. </tr>
  1027. <tr>
  1028. <td>snap</td>
  1029. <td>function or null</td>
  1030. <td>function</td>
  1031. <td>When moving items on the Timeline, they will be snapped to nice dates like full hours or days, depending on the current scale. The <code>snap</code> function can be replaced with a custom function, or can be set to <code>null</code> to disable snapping. The signature of the snap function is:
  1032. <pre class="prettyprint lang-js">function snap(date: Date, scale: string, step: number) : Date or number</pre>
  1033. The parameter <code>scale</code> can be can be 'millisecond', 'second', 'minute', 'hour', 'weekday, 'week', 'day', 'month', 'quarter' or 'year'. The parameter <code>step</code> is a number like 1, 2, 4, 5.
  1034. </td>
  1035. </tr>
  1036. <tr>
  1037. <td>start</td>
  1038. <td>Date or Number or String or Moment</td>
  1039. <td>none</td>
  1040. <td>The initial start date for the axis of the timeline.
  1041. If not provided, the earliest date present in the events is taken as start date.</td>
  1042. </tr>
  1043. <tr>
  1044. <td>template</td>
  1045. <td>function</td>
  1046. <td>none</td>
  1047. <td>A template function used to generate the contents of the items. The function is called by the Timeline with an items' data as the first argument, the item element as the second argument and the edited data as the third argument, and must return HTML code, a string or a template as result. When the option template is specified, the items do not need to have a field <code>content</code>. See section <a href="#Templates">Templates</a> for a detailed explanation.</td>
  1048. </tr>
  1049. <tr>
  1050. <td>visibleFrameTemplate</td>
  1051. <td>function</td>
  1052. <td>none</td>
  1053. <td>A template function used to generate the visible frame of the items. The function is called by the Timeline with an items' data as the first argument and the item frame element as the second, and must return HTML code, a string or a template as result. When the option template is specified, the items do not need to have a field <code>content</code>. See section <a href="#Templates">Templates</a> for a detailed explanation.
  1054. This would be used as an additional way to add content that is constant in size with the visible frame of the item and does not get visibly hidden with the item's internal container: <code>vis-item-overflow</code> which is <code>overflow:hidden</code>.</td>
  1055. </tr>
  1056. <tr class='deprecated'>
  1057. <td>throttleRedraw</td>
  1058. <td>number</td>
  1059. <td><code>0</code></td>
  1060. <td>This option is <b>DEPRECATED</b> and no longer supported. It will be removed in the next MAJOR release.</td>
  1061. </tr>
  1062. <tr class='toggle collapsible' onclick="toggleTable('optionTable','timeAxis', this);">
  1063. <td><span parent="timeAxis" class="right-caret"></span> timeAxis</td>
  1064. <td>Object</td>
  1065. <td><code>Object</code></td>
  1066. <td>Specify a fixed scale and step size for the time axis.</td>
  1067. </tr>
  1068. <tr parent="timeAxis" class="hidden">
  1069. <td class="indent">timeAxis.scale</td>
  1070. <td>String</td>
  1071. <td>none</td>
  1072. <td>Set a fixed scale for the time axis of the Timeline. Choose from <code>'millisecond'</code>, <code>'second'</code>, <code>'minute'</code>, <code>'hour'</code>, <code>'weekday'</code>, <code>'week'</code>, <code>'day'</code>, <code>'month'</code>, <code>'quarter'</code>, <code>'year'</code>. Example usage:
  1073. <pre class="prettyprint lang-js">var options = {
  1074. timeAxis: {scale: 'minute', step: 5}
  1075. }</pre>
  1076. <p>Note: The 'week' scale only works properly when <a href="#Localization">locales</a> are enabled.</p>
  1077. </td>
  1078. </tr>
  1079. <tr parent="timeAxis" class="hidden">
  1080. <td class="indent">timeAxis.step</td>
  1081. <td>number</td>
  1082. <td><code>1</code></td>
  1083. <td>
  1084. Set a fixed step size for the time axis. Only applicable when used together with <code>timeAxis.scale</code>.
  1085. Choose for example 1, 2, 5, or 10.</td>
  1086. </tr>
  1087. <tr>
  1088. <td>type</td>
  1089. <td>String</td>
  1090. <td>none</td>
  1091. <td>Specifies the default type for the timeline items. Choose from 'box', 'point', 'range', and 'background'. Note that individual items can override this default type. If undefined, the Timeline will auto detect the type from the items data: if a start and end date is available, a 'range' will be created, and else, a 'box' is created. Items of type 'background' are not editable.
  1092. </td>
  1093. </tr>
  1094. <tr class='toggle collapsible' onclick="toggleTable('optionTable','tooltip', this);">
  1095. <td><span parent="tooltip" class="right-caret"></span> tooltip</td>
  1096. <td>Object</td>
  1097. <td><code>Object</code></td>
  1098. <td>Specify how the tooltip is positioned.</td>
  1099. </tr>
  1100. <tr parent="tooltip" class="hidden">
  1101. <td class="indent">tooltip.followMouse</td>
  1102. <td>boolean</td>
  1103. <td><code>false</code></td>
  1104. <td>If true, tooltips will follow the mouse as they move around in the item.</td>
  1105. </tr>
  1106. <tr parent="tooltip" class="hidden">
  1107. <td class="indent">tooltip.overflowMethod</td>
  1108. <td>String</td>
  1109. <td><code>'flip'</code></td>
  1110. <td>
  1111. Set how the tooltip should act if it is about to overflow out of the timeline.<br />
  1112. Choose from <code>'cap'</code> and <code>'flip'</code>. <br />
  1113. If it is set to <code>'cap'</code>, the tooltip will just cap its position to inside to timeline. <br />
  1114. While if it is set to <code>'flip'</code>, the position of the tooltip will flip around the cursor so that a corner is at the cursor, and the rest of it is visible. <br />
  1115. </tr>
  1116. <tr class='toggle collapsible' onclick="toggleTable('optionTable','tooltipOnItemUpdateTime', this);">
  1117. <td><span parent="tooltipOnItemUpdateTime" class="right-caret"></span> tooltipOnItemUpdateTime</td>
  1118. <td>Object/Boolean</td>
  1119. <td><code>false</code></td>
  1120. <td>Show a tooltip on updating an item's time. Note: <code>editable.updateTime</code> must be <code>true</code></td>
  1121. </tr>
  1122. <tr parent="tooltipOnItemUpdateTime" class="hidden">
  1123. <td class="indent">template</td>
  1124. <td>Function</td>
  1125. <td>none</td>
  1126. <td>A template function used to generate the contents of the tooltip. The function is called by the Timeline with an item data as the first argument, and must return HTML code, a string or a template as result. See section <a href="#Templates">Templates</a> for a detailed explanation.
  1127. </td>
  1128. </tr>
  1129. <tr>
  1130. <td>verticalScroll</td>
  1131. <td>Boolean</td>
  1132. <td><code>false</code></td>
  1133. <td> Show a vertical scroll on the side of the group list and link it to the scroll event when zoom is not triggered. Notice that defining this option as <code>true</code> will NOT override <code>horizontalScroll</code>. The scroll event will be vertically ignored, but a vertical scrollbar will be visible
  1134. </td>
  1135. </tr>
  1136. <tr>
  1137. <td>width</td>
  1138. <td>String or Number</td>
  1139. <td><code>'100%'</code></td>
  1140. <td>The width of the timeline in pixels or as a percentage.</td>
  1141. </tr>
  1142. <tr>
  1143. <td>zoomable</td>
  1144. <td>boolean</td>
  1145. <td><code>true</code></td>
  1146. <td>
  1147. Specifies whether the Timeline can be zoomed by pinching or scrolling in the window.
  1148. Only applicable when option <code>moveable</code> is set <code>true</code>.
  1149. </td>
  1150. </tr>
  1151. <tr>
  1152. <td>zoomKey</td>
  1153. <td>String</td>
  1154. <td><code>''</code></td>
  1155. <td>Specifies whether the Timeline is only zoomed when an additional key is down.
  1156. Available values are '' (does not apply), 'altKey', 'ctrlKey', or 'metaKey'.
  1157. Only applicable when option <code>moveable</code> is set <code>true</code>.
  1158. </td>
  1159. </tr>
  1160. <tr>
  1161. <td>zoomMax</td>
  1162. <td>number</td>
  1163. <td><code>315360000000000</code></td>
  1164. <td>Set a maximum zoom interval for the visible range in milliseconds.
  1165. It will not be possible to zoom out further than this maximum.
  1166. Default value equals about 10000 years.
  1167. </td>
  1168. </tr>
  1169. <tr>
  1170. <td>zoomMin</td>
  1171. <td>number</td>
  1172. <td><code>10</code></td>
  1173. <td>Set a minimum zoom interval for the visible range in milliseconds.
  1174. It will not be possible to zoom in further than this minimum.
  1175. </td>
  1176. </tr>
  1177. </table>
  1178. <h2 id="Methods">Methods</h2>
  1179. <p>
  1180. The Timeline supports the following methods.
  1181. </p>
  1182. <table class="methods">
  1183. <tr>
  1184. <th>Method</th>
  1185. <th>Return&nbsp;Type</th>
  1186. <th>Description</th>
  1187. </tr>
  1188. <tr>
  1189. <td>addCustomTime([time] [, id] [, options])</td>
  1190. <td>number or String</td>
  1191. <td>
  1192. Add new vertical bar representing a custom time that can be optionally dragged by the user.<br>
  1193. Parameter <code>time</code> can be a Date, Number, or String, and is <code>new Date()</code> by default.<br>
  1194. Parameter <code>id</code> can be Number or String and is <code>undefined</code> by default.
  1195. The <code>id</code> is added as CSS class name of the custom time bar, allowing to style multiple time bars differently.<br>
  1196. Parameter <code>options</code> can be an Object of available options. <em>At present these options cannot be altered after the custom time bar is created.</em>:
  1197. <ul>
  1198. <li><code>editable: boolean </code><br>If true (default) the custom time bar can be dragged by the user. If false the time bar is fixed and can only be modified in code.</li>
  1199. </ul>
  1200. The method returns id of the created bar.
  1201. </td>
  1202. </tr>
  1203. <tr>
  1204. <td>destroy()</td>
  1205. <td>none</td>
  1206. <td>Destroy the Timeline. The timeline is removed from memory. all DOM elements and event listeners are cleaned up.
  1207. </td>
  1208. </tr>
  1209. <tr>
  1210. <td>fit([options])</td>
  1211. <td>none</td>
  1212. <td>Adjust the visible window such that it fits all items. See also function <code>focus(id)</code>.
  1213. Available options:
  1214. <ul>
  1215. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.
  1216. </li>
  1217. </ul>
  1218. </td>
  1219. </tr>
  1220. <tr>
  1221. <td>focus(id or ids [, options])</td>
  1222. <td>none</td>
  1223. <td>Adjust the visible window such that the selected item (or multiple items) are centered on screen. See also function <code>fit()</code>. Available options:
  1224. <ul>
  1225. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1226. </ul>
  1227. </td>
  1228. </tr>
  1229. <tr>
  1230. <td>getCurrentTime()</td>
  1231. <td>Date</td>
  1232. <td>Get the current time. Only applicable when option <code>showCurrentTime</code> is true.
  1233. </td>
  1234. </tr>
  1235. <tr>
  1236. <td>getCustomTime([id])</td>
  1237. <td>Date</td>
  1238. <td>Retrieve the custom time from the custom time bar with given id. Id is <code>undefined</code> by default.
  1239. </td>
  1240. </tr>
  1241. <tr id="getEventProperties">
  1242. <td>getEventProperties(event)</td>
  1243. <td>Object</td>
  1244. <td>
  1245. Returns an Object with relevant properties from an event:
  1246. <ul>
  1247. <li><code>group</code> (Number or null): the id of the clicked group.</li>
  1248. <li><code>item</code> (Number or null): the id of the clicked item.</li>
  1249. <li><code>pageX</code> (Number): absolute horizontal position of the click event.</li>
  1250. <li><code>pageY</code> (Number): absolute vertical position of the click event.</li>
  1251. <li><code>x</code> (Number): relative horizontal position of the click event.</li>
  1252. <li><code>y</code> (Number): relative vertical position of the click event.</li>
  1253. <li><code>time</code> (Date): Date of the clicked event.</li>
  1254. <li><code>snappedTime</code> (Date): Date of the clicked event, snapped to a nice value.</li>
  1255. <li><code>what</code> (String or null): name of the clicked thing: <code>item</code>, <code>background</code>, <code>axis</code>, <code>group-label</code>, <code>custom-time</code>, or <code>current-time</code>.</li>
  1256. <li><code>event</code> (Object): the original click event.</li>
  1257. </ul>
  1258. Example usage:
  1259. <pre class="prettyprint lang-js">
  1260. document.getElementById('myTimeline').onclick = function (event) {
  1261. var props = timeline.getEventProperties(event)
  1262. console.log(props);
  1263. }</pre>
  1264. </td>
  1265. </tr>
  1266. <tr>
  1267. <td>getItemRange()</td>
  1268. <td>Object</td>
  1269. <td>Get the range of all the items as an object containing <code>min: Date</code> and <code>max: Date</code>.</td>
  1270. </tr>
  1271. <tr>
  1272. <td>getSelection()</td>
  1273. <td>number[]</td>
  1274. <td>Get an array with the ids of the currently selected items.</td>
  1275. </tr>
  1276. <tr>
  1277. <td>getVisibleItems()</td>
  1278. <td>number[]</td>
  1279. <td>Get an array with the ids of the currently visible items.</td>
  1280. </tr>
  1281. <tr>
  1282. <td>getWindow()</td>
  1283. <td>Object</td>
  1284. <td>Get the current visible window. Returns an object with properties <code>start: Date</code> and <code>end: Date</code>.</td>
  1285. </tr>
  1286. <tr>
  1287. <td>isActive()</td>
  1288. <td>Boolean</td>
  1289. <td>Denotes whether the timeline is currently active. This method only returns <code>false</code> if the timline has the <code>{clickToUse:true}</code> option enabled and the timeline is currently unselected.</td>
  1290. </tr>
  1291. <tr>
  1292. <td>moveTo(time [, options, callback])</td>
  1293. <td>none</td>
  1294. <td>Move the window such that given time is centered on screen. Parameter <code>time</code> can be a <code>Date</code>, <code>Number</code>, or <code>String</code>. Available options:
  1295. <ul>
  1296. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1297. </ul>
  1298. A callback <code>function</code> can be passed as an optional parameter. This function will be called at the end of moveTo function.
  1299. </td>
  1300. </tr>
  1301. <tr>
  1302. <td>on(event, callback)</td>
  1303. <td>none</td>
  1304. <td>Create an event listener. The callback function is invoked every time the event is triggered. Available events: <code>rangechange</code>, <code>rangechanged</code>, <code>select</code>, <code>itemover</code>, <code>itemout</code>. The callback function is invoked as <code>callback(properties)</code>, where <code>properties</code> is an object containing event specific properties. See section <a href="#Events">Events for more information</a>.</td>
  1305. </tr>
  1306. <tr>
  1307. <td>off(event, callback)</td>
  1308. <td>none</td>
  1309. <td>Remove an event listener created before via function <code>on(event, callback)</code>. See section <a href="#Events">Events for more information</a>.</td>
  1310. </tr>
  1311. <tr>
  1312. <td>redraw()</td>
  1313. <td>none</td>
  1314. <td>Force a redraw of the Timeline. The size of all items will be recalculated.
  1315. Can be useful to manually redraw when option <code>autoResize=false</code> and the window
  1316. has been resized, or when the items CSS has been changed.
  1317. </td>
  1318. </tr>
  1319. <tr>
  1320. <td>removeCustomTime(id)</td>
  1321. <td>none</td>
  1322. <td>
  1323. Remove vertical bars previously added to the timeline via <code>addCustomTime</code> method. Parameter <code>id</code> is the ID of the custom vertical bar returned by <code>addCustomTime</code> method.
  1324. </td>
  1325. </tr>
  1326. <tr>
  1327. <td>setCurrentTime(time)</td>
  1328. <td>none</td>
  1329. <td>Set a current time. This can be used for example to ensure that a client's time is synchronized with a shared server time.
  1330. <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
  1331. Only applicable when option <code>showCurrentTime</code> is true.</td>
  1332. </tr>
  1333. <tr>
  1334. <td>setCustomTime(time [, id])</td>
  1335. <td>none</td>
  1336. <td>Adjust the time of a custom time bar.
  1337. Parameter <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
  1338. Parameter <code>id</code> is the id of the custom time bar, and is <code>undefined</code> by default.
  1339. </td>
  1340. </tr>
  1341. <tr>
  1342. <td>setCustomTimeTitle(title [, id])</td>
  1343. <td>none</td>
  1344. <td>Adjust the title attribute of a custom time bar.
  1345. Parameter <code>title</code> is the string or function to be set as title. Use empty string to hide the title completely.
  1346. Parameter <code>id</code> is the id of the custom time bar, and is <code>undefined</code> by default.
  1347. </td>
  1348. </tr>
  1349. <tr>
  1350. <td>setData({<br>&nbsp;&nbsp;groups: groups,<br>&nbsp;&nbsp;items: items<br>})</td>
  1351. <td>none</td>
  1352. <td>Set both groups and items at once. Both properties are optional. This is a convenience method for individually calling both <code>setItems(items)</code> and <code>setGroups(groups)</code>.
  1353. Both <code>items</code> and <code>groups</code> can be an Array with Objects,
  1354. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1355. For each of the groups, the items of the timeline are filtered on the
  1356. property <code>group</code>, which must correspond with the id of the group.
  1357. </td>
  1358. </tr>
  1359. <tr>
  1360. <td>setGroups(groups)</td>
  1361. <td>none</td>
  1362. <td>Set a data set with groups for the Timeline.
  1363. <code>groups</code> can be an Array with Objects,
  1364. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1365. For each of the groups, the items of the timeline are filtered on the
  1366. property <code>group</code>, which must correspond with the id of the group.
  1367. </td>
  1368. </tr>
  1369. <tr>
  1370. <td>setItems(items)</td>
  1371. <td>none</td>
  1372. <td>Set a data set with items for the Timeline.
  1373. <code>items</code> can be an Array with Objects,
  1374. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1375. </td>
  1376. </tr>
  1377. <tr>
  1378. <td>setOptions(options)</td>
  1379. <td>none</td>
  1380. <td>Set or update options. It is possible to change any option of the timeline at any time. You can for example switch orientation on the fly.
  1381. </td>
  1382. </tr>
  1383. <tr>
  1384. <td>setSelection(id or ids [, options])</td>
  1385. <td>none</td>
  1386. <td>Select one or multiple items by their id. The currently selected items will be unselected. To unselect all selected items, call `setSelection([])`. Available options:
  1387. <ul>
  1388. <li><code>focus: boolean</code><br>If true, focus will be set to the selected item(s)</li>
  1389. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Only applicable when option focus is true. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1390. </ul>
  1391. </td>
  1392. </tr>
  1393. <tr>
  1394. <td>setWindow(start, end [, options, callback])</td>
  1395. <td>none</td>
  1396. <td>Set the current visible window. The parameters <code>start</code> and <code>end</code> can be a <code>Date</code>, <code>Number</code>, or <code>String</code>. If the parameter value of <code>start</code> or <code>end</code> is null, the parameter will be left unchanged. Available options:
  1397. <ul>
  1398. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1399. </ul>
  1400. A callback <code>function</code> can be passed as an optional parameter. This function will be called at the end of setWindow function.
  1401. </td>
  1402. </tr>
  1403. <tr>
  1404. <td>toggleRollingMode()</td>
  1405. <td>none</td>
  1406. <td>Toggle rollingMode.
  1407. </td>
  1408. </tr>
  1409. <tr>
  1410. <td>zoomIn(percentage [, options, callback])</td>
  1411. <td>none</td>
  1412. <td>Zoom in the current visible window. The parameter <code>percentage</code> can be a <code>Number</code> and must be between 0 and 1. If the parameter value of <code>percentage</code> is null, the window will be left unchanged. Available options:
  1413. <ul>
  1414. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1415. </ul>
  1416. A callback <code>function</code> can be passed as an optional parameter. This function will be called at the end of zoomIn function.
  1417. </td>
  1418. </tr>
  1419. <tr>
  1420. <td>zoomOut(percentage [, options, callback])</td>
  1421. <td>none</td>
  1422. <td>Zoom out the current visible window. The parameter <code>percentage</code> can be a <code>Number</code> and must be between 0 and 1. If the parameter value of <code>percentage</code> is null, the window will be left unchanged. Available options:
  1423. <ul>
  1424. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1425. </ul>
  1426. A callback <code>function</code> can be passed as an optional parameter. This function will be called at the end of zoomOut function.
  1427. </td>
  1428. </tr>
  1429. </table>
  1430. <h2 id="Events">Events</h2>
  1431. <p>
  1432. Timeline fires events when changing the visible window by dragging, when
  1433. selecting items, and when dragging the custom time bar.
  1434. </p>
  1435. <p>
  1436. Here an example on how to listen for a <code>select</code> event.
  1437. </p>
  1438. <pre class="prettyprint lang-js">
  1439. timeline.on('select', function (properties) {
  1440. alert('selected items: ' + properties.items);
  1441. });
  1442. </pre>
  1443. <p>
  1444. A listener can be removed via the function <code>off</code>:
  1445. </p>
  1446. <pre class="prettyprint lang-js">
  1447. function onSelect (properties) {
  1448. alert('selected items: ' + properties.items);
  1449. }
  1450. // add event listener
  1451. timeline.on('select', onSelect);
  1452. // do stuff...
  1453. // remove event listener
  1454. timeline.off('select', onSelect);
  1455. </pre>
  1456. <p>
  1457. The following events are available.
  1458. </p>
  1459. <table class="events">
  1460. <tr>
  1461. <th>Name</th>
  1462. <th>Properties</th>
  1463. <th>Description</th>
  1464. </tr>
  1465. <tr>
  1466. <td>currentTimeTick</td>
  1467. <td>Has no properties</td>
  1468. <td>Fired when the current time bar redraws. The rate depends on the zoom level.</td>
  1469. </tr>
  1470. <tr>
  1471. <td>click</td>
  1472. <td>
  1473. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1474. </td>
  1475. <td>Fired when clicked inside the Timeline.
  1476. </td>
  1477. </tr>
  1478. <tr>
  1479. <td>contextmenu</td>
  1480. <td>
  1481. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1482. </td>
  1483. <td>Fired when right-clicked inside the Timeline. Note that in order to prevent the context menu from showing up, default behavior of the event must be stopped:
  1484. <pre class="prettyprint lang-js">timeline.on('contextmenu', function (props) {
  1485. alert('Right click!');
  1486. props.event.preventDefault();
  1487. });
  1488. </pre>
  1489. </td>
  1490. </tr>
  1491. <tr>
  1492. <td>doubleClick</td>
  1493. <td>
  1494. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1495. </td>
  1496. <td>Fired when double clicked inside the Timeline.
  1497. </td>
  1498. </tr>
  1499. <tr>
  1500. <td>drop</td>
  1501. <td>
  1502. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1503. </td>
  1504. <td>Fired when dropping inside the Timeline.
  1505. </td>
  1506. </tr>
  1507. <tr>
  1508. <td>mouseOver</td>
  1509. <td>
  1510. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1511. </td>
  1512. <td>Fired when the mouse hovers over a timeline element.
  1513. </td>
  1514. </tr>
  1515. <tr>
  1516. <td>mouseDown</td>
  1517. <td>
  1518. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1519. </td>
  1520. <td>Fired when the mouse down event is triggered over a timeline element.
  1521. </td>
  1522. </tr>
  1523. <tr>
  1524. <td>mouseUp</td>
  1525. <td>
  1526. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1527. </td>
  1528. <td>Fired when the mouse up event is triggered over a timeline element.
  1529. </td>
  1530. </tr>
  1531. <tr>
  1532. <td>mouseMove</td>
  1533. <td>
  1534. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1535. </td>
  1536. <td>Fired when the mouse is moved over a timeline element.
  1537. </td>
  1538. </tr>
  1539. <tr>
  1540. <td>groupDragged</td>
  1541. <td>
  1542. Passes the id of the dragged group.
  1543. </td>
  1544. <td>Fired after the dragging of a group is finished.
  1545. </td>
  1546. </tr>
  1547. <tr>
  1548. <td>changed</td>
  1549. <td>
  1550. Has no properties.
  1551. </td>
  1552. <td>Fired once after each graph redraw.
  1553. </td>
  1554. </tr>
  1555. <tr>
  1556. <td>rangechange</td>
  1557. <td>
  1558. <ul>
  1559. <li><code>start</code> (Number): timestamp of the current start of the window.</li>
  1560. <li><code>end</code> (Number): timestamp of the current end of the window.</li>
  1561. <li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
  1562. <li><code>event</code> (Object): original event triggering the rangechange.</li>
  1563. </ul>
  1564. </td>
  1565. <td>Fired repeatedly when the timeline window is being changed.
  1566. </td>
  1567. </tr>
  1568. <tr>
  1569. <td>rangechanged</td>
  1570. <td>
  1571. <ul>
  1572. <li><code>start</code> (Number): timestamp of the current start of the window.</li>
  1573. <li><code>end</code> (Number): timestamp of the current end of the window.</li>
  1574. <li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
  1575. <li><code>event</code> (Object): original event triggering the rangechanged.</li>
  1576. </ul>
  1577. </td>
  1578. <td>Fired once after the timeline window has been changed.
  1579. </td>
  1580. </tr>
  1581. <tr>
  1582. <td>select</td>
  1583. <td>
  1584. <ul>
  1585. <li><code>items</code>: an array with the ids of the selected items</li>
  1586. <li><code>event</code>: the original click event</li>
  1587. </ul>
  1588. </td>
  1589. <td>Fired after the user selects or deselects items by tapping or holding them.
  1590. When a user taps an already selected item, the select event is fired again.
  1591. Not fired when the method <code>setSelection</code>is executed.
  1592. </td>
  1593. </tr>
  1594. <tr>
  1595. <td>itemover</td>
  1596. <td>
  1597. <ul>
  1598. <li><code>item</code>: hovered item id</li>
  1599. <li><code>event</code>: the original mouseover event</li>
  1600. </ul>
  1601. </td>
  1602. <td>Fired when the user moves the mouse over an item.</td>
  1603. </tr>
  1604. <tr>
  1605. <td>itemout</td>
  1606. <td>
  1607. <ul>
  1608. <li><code>item</code>: hovered item id</li>
  1609. <li><code>event</code>: the original mouseout event</li>
  1610. </ul>
  1611. </td>
  1612. <td>Fired when the user moves the mouse out of an item.</td>
  1613. </tr>
  1614. <tr>
  1615. <td>timechange</td>
  1616. <td>
  1617. <ul>
  1618. <li><code>id</code> (Number or String): custom time bar id.</li>
  1619. <li><code>time</code> (Date): the custom time.</li>
  1620. <li><code>event</code> (Object): original event triggering the timechange.</li>
  1621. </ul>
  1622. </td>
  1623. <td>Fired repeatedly when the user is dragging the custom time bar.
  1624. Only available when the custom time bar is enabled.
  1625. </td>
  1626. </tr>
  1627. <tr>
  1628. <td>timechanged</td>
  1629. <td>
  1630. <ul>
  1631. <li><code>id</code> (Number or String): custom time bar id.</li>
  1632. <li><code>time</code> (Date): the custom time.</li>
  1633. <li><code>event</code> (Object): original event triggering the timechanged.</li>
  1634. </ul>
  1635. </td>
  1636. <td>Fired once after the user has dragged the custom time bar.
  1637. Only available when the custom time bar is enabled.
  1638. </td>
  1639. </tr>
  1640. </table>
  1641. <h2 id="Editing_Items">Editing Items</h2>
  1642. <p>
  1643. When the Timeline is configured to be editable (both options <code>selectable</code> and <code>editable</code> are <code>true</code>), the user can:
  1644. </p>
  1645. <ul>
  1646. <li>Select an item by clicking it, and use ctrl+click to or shift+click to select multiple items (when <code>multiselect: true</code>).</li>
  1647. <li>Move selected items by dragging them.</li>
  1648. <li>Create a new item by double tapping on an empty space.</li>
  1649. <li>Create a new range item by dragging on an empty space with the ctrl key down.</li>
  1650. <li>Update an item by double tapping it.</li>
  1651. <li>Delete a selected item by clicking the delete button on the top right.</li>
  1652. </ul>
  1653. <p>Option <code>editable</code> accepts a boolean or an object. When <code>editable</code> is a boolean, all manipulation actions will be either enabled or disabled. When <code>editable</code> is an object, one can enable individual manipulation actions:</p>
  1654. <pre class="prettyprint lang-js">// enable or disable all manipulation actions
  1655. var options = {
  1656. editable: true // true or false
  1657. };
  1658. // enable or disable individual manipulation actions
  1659. var options = {
  1660. editable: {
  1661. add: true, // add new items by double tapping
  1662. updateTime: true, // drag items horizontally
  1663. updateGroup: true, // drag items from one group to another
  1664. remove: true, // delete an item by tapping the delete button top right
  1665. overrideItems: false // allow these options to override item.editable
  1666. }
  1667. };</pre>
  1668. <p>
  1669. Editing can be enabled/disabled for specific items. Setting the property <code>editable</code> to <code>true</code> or <code>false</code> on a data item will override the timeline option except when <code>timeline.editable.overrideItems</code> is set to <code>true</code>.
  1670. </p>
  1671. <pre class="prettyprint lang-js">
  1672. var items = new vis.DataSet([
  1673. {id: 1, content: 'read-only item', start: '2013-04-20', editable: false},
  1674. {id: 2, content: 'editable item', start: '2013-04-14'}
  1675. ]);
  1676. </pre>
  1677. <p>
  1678. Individual manipulation actions (<code>updateTime</code>, <code>updateGroup</code> and <code>remove</code>) can also be set on individual items. If any of the item-level
  1679. actions are specified (and <code>overrideItems</code> is not <code>false</code>) then that takes precedence over the settings at the timeline level. Current behavior is
  1680. that if any of the item-level actions are not specified, those items get <code>undefined</code> value (rather than inheriting from the timeline level). This may change
  1681. in future major releases, and code that specifies all item level values will handle major release changes better. That is, instead of using
  1682. <code>editable: {updateTime : true}</code>, use <code>editable: {updateTime : true, updateGroup: false, remove: false}</code>.
  1683. </p>
  1684. <p>
  1685. One can specify callback functions to validate changes made by the user. There are a number of callback functions for this purpose:
  1686. </p>
  1687. <ul>
  1688. <li><code>onAdd(item, callback)</code> Fired when a new item is about to be added. If not implemented, the item will be added with default text contents.</li>
  1689. <li><code>onUpdate(item, callback)</code> Fired when an item is about to be updated. This function typically has to show a dialog where the user change the item. If not implemented, nothing happens.</li>
  1690. <li><code>onDropObjectOnItem(objectData, item)</code> Fired when an object is dropped in to an existing timeline item.</li>
  1691. <li><code>onMove(item, callback)</code> Fired when an item has been moved. If not implemented, the move action will be accepted.</li>
  1692. <li><code>onMoving(item, callback)</code> Fired repeatedly while an item is being moved (dragged). Can be used to adjust the items start, end, and/or group to allowed regions.</li>
  1693. <li><code>onRemove(item, callback)</code> Fired when an item is about to be deleted. If not implemented, the item will be always removed.</li>
  1694. </ul>
  1695. <p>
  1696. Each of the callbacks is invoked with two arguments:
  1697. </p>
  1698. <ul>
  1699. <li><code>item</code>: the item being manipulated</li>
  1700. <li><code>callback</code>: a callback function which must be invoked to report back. The callback must be invoked as <code>callback(item)</code> or <code>callback(null)</code>.
  1701. Here, <code>item</code> can contain changes to the passed item. Parameter <code>item</code> typically contains fields `content`, `start`, and optionally `end`. The type of `start`
  1702. and `end` is determined by the DataSet type configuration and is `Date` by default. When invoked as <code>callback(null)</code>, the action will be cancelled.</li>
  1703. </ul>
  1704. <p>
  1705. Example code:
  1706. </p>
  1707. <pre class="prettyprint lang-js">var options = {
  1708. onUpdate: function (item, callback) {
  1709. item.content = prompt('Edit items text:', item.content);
  1710. if (item.content != null) {
  1711. callback(item); // send back adjusted item
  1712. }
  1713. else {
  1714. callback(null); // cancel updating the item
  1715. }
  1716. }
  1717. };
  1718. </pre>
  1719. A full example is available here: <a href="../../examples/timeline/editing/editingItemsCallbacks.html">editingItemsCallbacks.html</a>.
  1720. <h2 id="Templates">Templates</h2>
  1721. <p>
  1722. Timeline supports templates to format item contents. Any template engine (such as <a href="http://handlebarsjs.com/">handlebars</a> or <a href="http://mustache.github.io/">mustache</a>) 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 the first argument, the item element as the second argument and the edited data as the third argument, and outputs formatted HTML:
  1723. </p>
  1724. <pre class="prettyprint lang-js">var options = {
  1725. template: function (item, element, data) {
  1726. var html = ... // generate HTML markup for this item
  1727. return html;
  1728. }
  1729. };
  1730. </pre>
  1731. <h3>Create HTML manually</h3>
  1732. The HTML for an item can be created manually:
  1733. <pre class="prettyprint lang-js">var options = {
  1734. template: function (item, element, data) {
  1735. return '&lt;h1&gt;' + item.header + data.moving?' '+ data.start:'' + '&lt;/h1&gt;&lt;p&gt;' + item.description + '&lt;/p&gt;';
  1736. },
  1737. onMoving: function (item, callback) {
  1738. item.moving = true;
  1739. }
  1740. };
  1741. </pre>
  1742. <h3>Using a template engine</h3>
  1743. Using <a href="http://handlebarsjs.com/">handlebars</a>, one can write the template in HTML:
  1744. <pre class="prettyprint lang-html">
  1745. &lt;script id="item-template" type="text/x-handlebars-template"&gt;
  1746. &lt;h1&gt;{{header}}&lt;/h1&gt;
  1747. &lt;p&gt;{{description}}&lt;/p&gt;
  1748. &lt;/script&gt;
  1749. </pre>
  1750. Compile the template:
  1751. <pre class="prettyprint lang-js">
  1752. var source = document.getElementById('item-template').innerHTML;
  1753. var template = Handlebars.compile(source);
  1754. </pre>
  1755. And then specify the template in the Timeline options
  1756. <pre class="prettyprint lang-js">var options = {
  1757. template: template
  1758. };
  1759. </pre>
  1760. <h3>React templates</h3>
  1761. You can use a React component for the templates by rendering them to the templates' element directly:
  1762. <pre class="prettyprint lang-js">
  1763. template: function (item, element, data) {
  1764. return ReactDOM.render(&lt;b&gt;{item.content}&lt;/b&gt;, element);
  1765. },
  1766. </pre>
  1767. <h3>Multiple templates</h3>
  1768. In order to support multiple templates, the template handler can be extended to switch between different templates, depending on a specific item property:
  1769. <pre class="prettyprint lang-js">
  1770. var templates = {
  1771. template1: Handlebars.compile(...),
  1772. template2: Handlebars.compile(...),
  1773. template2: Handlebars.compile(...),
  1774. ...
  1775. };
  1776. var options = {
  1777. template: function (item, element, data) {
  1778. var template = templates[item.template]; // choose the right template
  1779. return template(item); // execute the template
  1780. }
  1781. };
  1782. </pre>
  1783. Now the items can be extended with a property <code>template</code>, specifying which template to use for the item.
  1784. <h2 id="Localization">Localization</h2>
  1785. <p>
  1786. Timeline can be localized. For localization, Timeline depends largely on the localization of <a href="http://momentjs.com">moment.js</a>. Locales are not included in vis.js by default. To enable localization, moment.js must be loaded with locales. Moment.js offers a bundle named "moment-with-locales.min.js" for this and there are various alternative ways to load locales.
  1787. </p>
  1788. <p>
  1789. To set a locale for the Timeline, specify the option <code>locale</code>:
  1790. </p>
  1791. <pre class="prettyprint lang-js">var options = {
  1792. locale: 'nl'
  1793. };
  1794. </pre>
  1795. <h3>Create a new locale</h3>
  1796. To load a locale (that is not supported by default) into the Timeline, one can add a new locale to the option <code>locales</code>:
  1797. <pre class="prettyprint lang-js">var options = {
  1798. locales: {
  1799. // create a new locale (text strings should be replaced with localized strings)
  1800. mylocale: {
  1801. current: 'current',
  1802. time: 'time',
  1803. }
  1804. },
  1805. // use the new locale
  1806. locale: 'mylocale'
  1807. };
  1808. </pre>
  1809. <h3 id="available-locales">Available locales</h3>
  1810. <p>
  1811. Timeline comes with support for the following locales:
  1812. </p>
  1813. <table>
  1814. <tr>
  1815. <th>Language</th>
  1816. <th>Code</th>
  1817. </tr>
  1818. <tr>
  1819. <td>English</td>
  1820. <td>
  1821. <code>en</code><br>
  1822. <code>en_EN</code><br>
  1823. <code>en_US</code>
  1824. </td>
  1825. </tr>
  1826. <tr>
  1827. <td>Italian</td>
  1828. <td>
  1829. <code>it</code><br>
  1830. <code>it_IT</code><br>
  1831. <code>it_CH</code>
  1832. </td>
  1833. </tr>
  1834. <tr>
  1835. <td>Dutch</td>
  1836. <td>
  1837. <code>nl</code><br>
  1838. <code>nl_NL</code><br>
  1839. <code>nl_BE</code>
  1840. </td>
  1841. </tr>
  1842. <tr>
  1843. <td>German</td>
  1844. <td>
  1845. <code>de</code><br>
  1846. <code>de_DE</code><br>
  1847. </td>
  1848. </tr>
  1849. </table>
  1850. <h2 id="Time_zone">Time zone</h2>
  1851. <p>
  1852. 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 <code>moment</code>, which by default is the constructor function of moment.js. More information about UTC with moment.js can be found in the docs: <a href="http://momentjs.com/docs/#/parsing/utc/">http://momentjs.com/docs/#/parsing/utc/</a>.
  1853. </p>
  1854. <p>
  1855. Examples:
  1856. </p>
  1857. <pre class="prettyprint lang-js">// display in UTC
  1858. var options = {
  1859. moment: function(date) {
  1860. return vis.moment(date).utc();
  1861. }
  1862. };
  1863. // display in UTC +08:00
  1864. var options = {
  1865. moment: function(date) {
  1866. return vis.moment(date).utcOffset('+08:00');
  1867. }
  1868. };
  1869. </pre>
  1870. <h2 id="Styles">Styles</h2>
  1871. <p>
  1872. All parts of the Timeline have a class name and a default css style.
  1873. The styles can be overwritten, which enables full customization of the layout
  1874. of the Timeline.
  1875. </p>
  1876. <p>For example, to change the border and background color of all items, include the
  1877. following code inside the head of your html code or in a separate stylesheet.</p>
  1878. <pre class="prettyprint lang-html">&lt;style&gt;
  1879. .vis-item {
  1880. border-color: orange;
  1881. background-color: yellow;
  1882. }
  1883. &lt;/style&gt;
  1884. </pre>
  1885. <h3 id="Grid_Backgrounds">Grid Backgrounds</h3>
  1886. <p>
  1887. The background grid of the time axis can be styled, for example to highlight
  1888. weekends or to create grids with an alternating white/lightgray background.
  1889. </p>
  1890. <p>
  1891. Depending on the zoom level, the grids get certain css classes attached.
  1892. The following classes are available:
  1893. </p>
  1894. <table class="styles">
  1895. <tr>
  1896. <th>Description</th><th>Values</th>
  1897. </tr>
  1898. <tr>
  1899. <td>Alternating columns</td><td><code>vis-even</code>, <code>vis-odd</code></td>
  1900. </tr>
  1901. <tr>
  1902. <td>Current date</td><td><code>vis-today</code>, <code>vis-tomorrow</code>, <code>vis-yesterday</code>, <code>vis-current-week</code>, <code>vis-current-month</code>, <code>vis-current-year</code></td>
  1903. </tr>
  1904. <tr>
  1905. <td>Hours</td><td><code>vis-h0</code>, <code>vis-h1</code>, ..., <code>vis-h23</code></td>
  1906. </tr>
  1907. <tr>
  1908. <td>Grouped hours</td><td><code>vis-h0-h4</code> to <code>vis-h20-h24</code></td>
  1909. </tr>
  1910. <tr>
  1911. <td>Weekday</td><td><code>vis-monday</code>, <code>vis-tuesday</code>, <code>vis-wednesday</code>, <code>vis-thursday</code>, <code>vis-friday</code>, <code>vis-saturday</code>, <code>vis-sunday</code></td>
  1912. </tr>
  1913. <tr>
  1914. <td>Days</td><td><code>vis-day1</code>, <code>vis-day2</code>, ..., <code>vis-day31</code></td>
  1915. </tr>
  1916. <tr>
  1917. <td>Week</td><td><code>vis-week1</code>, <code>vis-week2</code>, ..., <code>vis-week53</code></td>
  1918. </tr>
  1919. <tr>
  1920. <td>Months</td><td><code>vis-january</code>, <code>vis-february</code>, <code>vis-march</code>, <code>vis-april</code>, <code>vis-may</code>, <code>vis-june</code>, <code>vis-july</code>, <code>vis-august</code>, <code>vis-september</code>, <code>vis-october</code>, <code>vis-november</code>, <code>vis-december</code></td>
  1921. </tr>
  1922. <tr>
  1923. <td>Years</td><td><code>vis-year2014</code>, <code>vis-year2015</code>, ...</td>
  1924. </tr>
  1925. </table>
  1926. <p>
  1927. Note: the 'week' scale is not included in the automatic zoom levels as its scale is not a direct logical successor of 'days' nor a logical predecessor of 'months'. Same goes for the 'quarter' scale which is not a direct logical successor of 'months' nor a logical predecessor of 'years'.
  1928. </p>
  1929. <p>Examples:</p>
  1930. <pre class="prettyprint lang-html">&lt;style&gt;
  1931. /* alternating column backgrounds */
  1932. .vis-time-axis .grid.vis-odd {
  1933. background: #f5f5f5;
  1934. }
  1935. /* gray background in weekends, white text color */
  1936. .vis-time-axis .vis-grid.vis-saturday,
  1937. .vis-time-axis .vis-grid.vis-sunday {
  1938. background: gray;
  1939. }
  1940. .vis-time-axis .vis-text.vis-saturday,
  1941. .vis-time-axis .vis-text.vis-sunday {
  1942. color: white;
  1943. }
  1944. &lt;/style&gt;
  1945. </pre>
  1946. <h3 id="Performance_Tips">Performance Tips</h3>
  1947. <p>Defining a timeline with many items and/or groups might affect initial loading time and general performance.
  1948. Here are some tips to improve performance and avoid slow loading time:</p>
  1949. <ul>
  1950. <li>Define items and group with <code>DataSets</code></li>
  1951. <li>Avoid applying heavy CSS on items (such as <code>box-shadow</code>, gradient background colors, etc.)</li>
  1952. <li>Defining a <code>start</code> and an <code>end</code> in the timeline options.
  1953. This will improve initial loading time.</li>
  1954. </ul>
  1955. </div>
  1956. <?js= self.partial('tmpl/html-foot.tmpl') ?>