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.

2106 lines
85 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
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
9 years ago
  1. <!DOCTYPE html>
  2. <html lang="en"><head>
  3. <meta charset="utf-8">
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="description" content="">
  7. <meta name="author" content="">
  8. <link rel="icon" HREF="favicon.ico">
  9. <title>timeline - vis.js - A dynamic, browser based visualization library.</title>
  10. <!-- Bootstrap core CSS -->
  11. <link href="../css/bootstrap.css" rel="stylesheet">
  12. <!-- Tipue vendor css -->
  13. <link href="../css/tipuesearch.css" rel="stylesheet">
  14. <link href="../css/style.css" rel="stylesheet">
  15. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  16. <!--[if lt IE 9]>
  17. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  18. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  19. <![endif]-->
  20. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  21. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  22. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  23. <script src="../js/smooth-scroll.min.js"></script>
  24. <script language="JavaScript">
  25. smoothScroll.init();
  26. </script>
  27. <!-- Tipue vendor css -->
  28. <link href="../css/tipuesearch.css" rel="stylesheet">
  29. <!-- Tipue vendor css -->
  30. <link href="../css/tipuesearch.css" rel="stylesheet">
  31. <script type="text/javascript" src="../js/toggleTable.js"></script>
  32. </head>
  33. <body onload="prettyPrint();">
  34. <div class="navbar-wrapper">
  35. <div class="container">
  36. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  37. <div class="container">
  38. <div class="navbar-header">
  39. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  40. aria-expanded="false" aria-controls="navbar">
  41. <span class="sr-only">Toggle navigation</span>
  42. <span class="icon-bar"></span>
  43. <span class="icon-bar"></span>
  44. <span class="icon-bar"></span>
  45. </button>
  46. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  47. </div>
  48. <div id="navbar" class="navbar-collapse collapse">
  49. <ul class="nav navbar-nav">
  50. <li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
  51. <li><a href="http://www.visjs.org/blog.html">Blog</a></li>
  52. <li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
  53. <li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
  54. <li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
  55. <li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
  56. <li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
  57. </ul>
  58. </div>
  59. </div>
  60. </nav>
  61. </div>
  62. </div>
  63. <a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  64. <div class="container full">
  65. <h1>Timeline</h1>
  66. <h2 id="Overview">Overview</h2>
  67. <p>
  68. The Timeline is an interactive visualization chart to visualize data in time.
  69. The data items can take place on a single date, or have a start and end date (a range).
  70. You can freely move and zoom in the timeline by dragging and scrolling in the
  71. Timeline. Items can be created, edited, and deleted in the timeline.
  72. The time scale on the axis is adjusted automatically, and supports scales ranging
  73. from milliseconds to years.
  74. </p>
  75. <p>
  76. Timeline uses regular HTML DOM to render the timeline and items put on the
  77. timeline. This allows for flexible customization using css styling.
  78. </p>
  79. <h2 id="Contents">Contents</h2>
  80. <ul>
  81. <li><a href="#Overview">Overview</a></li>
  82. <li><a href="#Example">Example</a></li>
  83. <li><a href="#Loading">Loading</a></li>
  84. <li><a href="#Data_Format">Data Format</a>
  85. <ul>
  86. <li><a href="#items">Items</a></li>
  87. <li><a href="#groups">Groups</a></li>
  88. </ul>
  89. </li>
  90. <li><a href="#Configuration_Options">Configuration Options</a></li>
  91. <li><a href="#Methods">Methods</a></li>
  92. <li><a href="#Events">Events</a></li>
  93. <li><a href="#Editing_Items">Editing Items</a></li>
  94. <li><a href="#Templates">Templates</a></li>
  95. <li><a href="#Localization">Localization</a></li>
  96. <li><a href="#Time_zone">Time zone</a></li>
  97. <li><a href="#Styles">Styles</a></li>
  98. </ul>
  99. <h2 id="Example">Example</h2>
  100. <p>
  101. The following code shows how to create a Timeline and provide it with data.
  102. More examples can be found in the <a href="../../timeline_examples.html">timeline examples</a> page.
  103. </p>
  104. <pre class="prettyprint lang-html">&lt;!DOCTYPE HTML&gt;
  105. &lt;html&gt;
  106. &lt;head&gt;
  107. &lt;title&gt;Timeline | Basic demo&lt;/title&gt;
  108. &lt;style type="text/css"&gt;
  109. body, html {
  110. font-family: sans-serif;
  111. }
  112. &lt;/style&gt;
  113. &lt;script src="../../dist/vis.js"&gt;&lt;/script&gt;
  114. &lt;link href="../../dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  115. &lt;/head&gt;
  116. &lt;body&gt;
  117. &lt;div id="visualization"&gt;&lt;/div&gt;
  118. &lt;script type="text/javascript"&gt;
  119. // DOM element where the Timeline will be attached
  120. var container = document.getElementById('visualization');
  121. // Create a DataSet (allows two way data-binding)
  122. var items = new vis.DataSet([
  123. {id: 1, content: 'item 1', start: '2013-04-20'},
  124. {id: 2, content: 'item 2', start: '2013-04-14'},
  125. {id: 3, content: 'item 3', start: '2013-04-18'},
  126. {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
  127. {id: 5, content: 'item 5', start: '2013-04-25'},
  128. {id: 6, content: 'item 6', start: '2013-04-27'}
  129. ]);
  130. // Configuration for the Timeline
  131. var options = {};
  132. // Create a Timeline
  133. var timeline = new vis.Timeline(container, items, options);
  134. &lt;/script&gt;
  135. &lt;/body&gt;
  136. &lt;/html&gt;
  137. </pre>
  138. <h2 id="Loading">Loading</h2>
  139. <p>
  140. Install or download the <a href="http://visjs.org" target="_blank">vis.js</a> library
  141. in a subfolder of your project. Include the library's script and css files in the
  142. head of your html code:
  143. </p>
  144. <pre class="prettyprint lang-html">
  145. &lt;script src="vis/dist/vis.js"&gt;&lt;/script&gt;
  146. &lt;link href="vis/dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  147. </pre>
  148. The constructor of the Timeline is <code>vis.Timeline</code>
  149. <pre class="prettyprint lang-js">var timeline = new vis.Timeline(container, items, options);</pre>
  150. or when using groups:
  151. <pre class="prettyprint lang-js">var timeline = new vis.Timeline(container, items, groups, options);</pre>
  152. The constructor accepts four parameters:
  153. <ul>
  154. <li>
  155. <code>container</code> is the DOM element in which to create the timeline.
  156. </li>
  157. <li>
  158. <code>items</code> is an Array containing items. The properties of an
  159. item are described in section <a href="#Data_Format">Data Format, items</a>.
  160. </li><li>
  161. <code>groups</code> is an Array containing groups. The properties of a
  162. group are described in section <a href="#groups">Data Format, groups</a>.
  163. </li>
  164. <li>
  165. <code>options</code> is an optional Object containing a name-value map
  166. with options. Options can also be set using the method
  167. <code>setOptions</code>.
  168. </li>
  169. </ul>
  170. <h2 id="Data_Format">Data Format</h2>
  171. <p>
  172. The timeline can be provided with two types of data:
  173. </p>
  174. <ul>
  175. <li><a href="#items">Items</a> containing a set of items to be displayed in time.</li>
  176. <li><a href="#groups">Groups</a> containing a set of groups used to group items
  177. together.</li>
  178. </ul>
  179. <h3 id="items">Items</h3>
  180. <p>
  181. For items, the Timeline accepts an Array, a DataSet (offering 2 way data binding),
  182. or a DataView (offering 1 way data binding).
  183. Items are regular objects and can contain the properties <code>start</code>,
  184. <code>end</code> (optional), <code>content</code>,
  185. <code>group</code> (optional), <code>className</code> (optional),
  186. <code>editable</code> (optional), and <code>style</code> (optional).
  187. </p>
  188. <p>
  189. A DataSet is constructed as:
  190. </p>
  191. <pre class="prettyprint lang-js">
  192. var items = new vis.DataSet([
  193. {
  194. start: new Date(2010, 7, 15),
  195. end: new Date(2010, 8, 2), // end is optional
  196. content: 'Trajectory A'
  197. // Optional: fields 'id', 'type', 'group', 'className', 'style'
  198. }
  199. // more items...
  200. ]);
  201. </pre>
  202. <p>
  203. The item properties are defined as:
  204. </p>
  205. <table class="properties" id="itemOptionTable">
  206. <tr>
  207. <th>Name</th>
  208. <th>Type</th>
  209. <th>Required</th>
  210. <th>Description</th>
  211. </tr>
  212. <tr>
  213. <td>className</td>
  214. <td>String</td>
  215. <td>no</td>
  216. <td>This field is optional. A className can be used to give items
  217. an individual css style. For example, when an item has className
  218. 'red', one can define a css style like:
  219. <pre class="prettyprint lang-css">
  220. .vis-item.red {
  221. color: white;
  222. background-color: red;
  223. border-color: darkred;
  224. }</pre>
  225. More details on how to style items can be found in the section
  226. <a href="#Styles">Styles</a>.
  227. </td>
  228. </tr>
  229. <tr>
  230. <td>content</td>
  231. <td>String</td>
  232. <td>yes</td>
  233. <td>The contents of the item. This can be plain text or html code.</td>
  234. </tr>
  235. <tr>
  236. <td>end</td>
  237. <td>Date or number or string or Moment</td>
  238. <td>no</td>
  239. <td>The end date of the item. The end date is optional, and can be left <code>null</code>.
  240. If end date is provided, the item is displayed as a range.
  241. If not, the item is displayed as a box.</td>
  242. </tr>
  243. <tr>
  244. <td>group</td>
  245. <td>any type</td>
  246. <td>no</td>
  247. <td>This field is optional. When the group column is provided,
  248. all items with the same group are placed on one line.
  249. A vertical axis is displayed showing the groups.
  250. Grouping items can be useful for example when showing availability of multiple
  251. people, rooms, or other resources next to each other.<br>
  252. </td>
  253. </tr>
  254. <tr>
  255. <td>id</td>
  256. <td>String or Number</td>
  257. <td>no</td>
  258. <td>An id for the item. Using an id is not required but highly
  259. recommended. An id is needed when dynamically adding, updating,
  260. and removing items in a DataSet.</td>
  261. </tr>
  262. <tr>
  263. <td>start</td>
  264. <td>Date or number or string or Moment</td>
  265. <td>yes</td>
  266. <td>The start date of the item, for example <code>new Date(2010,9,23)</code>.</td>
  267. </tr>
  268. <tr>
  269. <td>style</td>
  270. <td>String</td>
  271. <td>no</td>
  272. <td>
  273. A css text string to apply custom styling for an individual item, for
  274. example <code>"color: red; background-color: pink;"</code>.
  275. </td>
  276. </tr>
  277. <tr>
  278. <td>subgroup</td>
  279. <td>String or Number</td>
  280. <td>none</td>
  281. <td>The id of a subgroup.
  282. Groups all items within a group per subgroup, and positions them on the
  283. same height instead of staking them on top of each other. can be ordered
  284. by specifying the option <code>subgroupOrder</code> of a group.
  285. </td>
  286. </tr>
  287. <tr>
  288. <td>title</td>
  289. <td>String</td>
  290. <td>none</td>
  291. <td>Add a title for the item, displayed when holding the mouse on the item.
  292. The title can be an HTML element or a string containing plain text or HTML.
  293. </td>
  294. </tr>
  295. <tr>
  296. <td>type</td>
  297. <td>String</td>
  298. <td>no</td>
  299. <td>The type of the item. Can be 'box' (default), 'point', 'range', or 'background'.
  300. Types 'box' and 'point' need a start date, the types 'range' and 'background' needs both a start and end date.
  301. </td>
  302. </tr>
  303. <tr class='toggle collapsible' onclick="toggleTable('itemOptionTable', 'itemEditable', this);">
  304. <td><span parent="itemEditable" class="right-caret"></span> editable</td>
  305. <td>Boolean or Object</td>
  306. <td>no</td>
  307. <td>Override the editable option of the timeline for a specific item (assuming <code>timeline.editable.overrideItems</code> is false).</td>
  308. </tr>
  309. <tr parent="itemEditable" class="hidden">
  310. <td class="indent">editable.remove</td>
  311. <td>boolean</td>
  312. <td>no</td>
  313. <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>
  314. </tr>
  315. <tr parent="itemEditable" class="hidden">
  316. <td class="indent">editable.updateGroup</td>
  317. <td>boolean</td>
  318. <td>no</td>
  319. <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>
  320. </tr>
  321. <tr parent="itemEditable" class="hidden">
  322. <td class="indent">editable.updateTime</td>
  323. <td>boolean</td>
  324. <td>no</td>
  325. <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>
  326. </tr>
  327. </table>
  328. <h3 id="groups">Groups</h3>
  329. <p>
  330. For the items, groups can be an Array, a DataSet (offering 2 way data binding),
  331. or a DataView (offering 1 way data binding).
  332. Using groups, items can be grouped together.
  333. Items are filtered per group, and displayed as
  334. Group items can contain the properties <code>id</code>,
  335. <code>content</code>, and <code>className</code> (optional).
  336. </p>
  337. <p>
  338. Groups can be applied to a timeline using the method <code>setGroups</code> or supplied in the constructor.
  339. A table with groups can be created like:
  340. </p>
  341. <pre class="prettyprint lang-js">
  342. var groups = [
  343. {
  344. id: 1,
  345. content: 'Group 1'
  346. // Optional: a field 'className', 'style', 'order', [properties]
  347. }
  348. // more groups...
  349. ]);
  350. </pre>
  351. <p>
  352. Groups can have the following properties:
  353. </p>
  354. <table class="properties">
  355. <tr>
  356. <th>Name</th>
  357. <th>Type</th>
  358. <th>Required</th>
  359. <th>Description</th>
  360. </tr>
  361. <tr>
  362. <td>className</td>
  363. <td>String</td>
  364. <td>no</td>
  365. <td>This field is optional. A className can be used to give groups
  366. an individual css style. For example, when a group has className
  367. 'red', one can define a css style
  368. <code>
  369. .red {
  370. color: red;
  371. }
  372. </code>.
  373. More details on how to style groups can be found in the section
  374. <a href="#Styles">Styles</a>.
  375. </td>
  376. </tr>
  377. <tr>
  378. <td>content</td>
  379. <td>String or Element</td>
  380. <td>yes</td>
  381. <td>The contents of the group. This can be plain text, html code or an html element.</td>
  382. </tr>
  383. <tr>
  384. <td>id</td>
  385. <td>String or Number</td>
  386. <td>yes</td>
  387. <td>An id for the group. The group will display all items having a
  388. property <code>group</code> which matches the <code>id</code>
  389. of the group.</td>
  390. </tr>
  391. <tr>
  392. <td>style</td>
  393. <td>String</td>
  394. <td>no</td>
  395. <td>
  396. A css text string to apply custom styling for an individual group label, for
  397. example <code>"color: red; background-color: pink;"</code>.
  398. </td>
  399. </tr>
  400. <tr>
  401. <td>subgroupOrder</td>
  402. <td>String or Function</td>
  403. <td>none</td>
  404. <td>Order the subgroups by a field name or custom sort function.
  405. By default, groups are ordered by first-come, first-show.
  406. </td>
  407. </tr>
  408. <tr>
  409. <td>title</td>
  410. <td>String</td>
  411. <td>none</td>
  412. <td>A title for the group, displayed when holding the mouse on the groups label.
  413. The title can only contain plain text.
  414. </td>
  415. </tr>
  416. <tr>
  417. <td>visible</td>
  418. <td>Boolean</td>
  419. <td>no</td>
  420. <td>Provides a means to toggle the whether a group is displayed or not. Defaults to <code>true</code>.</td>
  421. </tr>
  422. <tr>
  423. <td>nestedGroups</td>
  424. <td>Array</td>
  425. <td>no</td>
  426. <td>Array of group ids nested in the group. Nested groups will appear under this nesting group.</td>
  427. </tr>
  428. <tr>
  429. <td>showNested</td>
  430. <td>Boolean</td>
  431. <td>no</td>
  432. <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>
  433. </tr>
  434. </table>
  435. <h2 id="Configuration_Options">Configuration Options</h2>
  436. <p>
  437. Options can be used to customize the timeline.
  438. Options are defined as a JSON object. All options are optional.
  439. </p>
  440. <pre class="prettyprint lang-js">
  441. var options = {
  442. width: '100%',
  443. height: '30px',
  444. margin: {
  445. item: 20
  446. }
  447. };
  448. </pre>
  449. <p>
  450. The following options are available.
  451. </p>
  452. <table class="options" id="optionTable">
  453. <tr>
  454. <th>Name</th>
  455. <th>Type</th>
  456. <th>Default</th>
  457. <th>Description</th>
  458. </tr>
  459. <tr>
  460. <td>align</td>
  461. <td>String</td>
  462. <td><code>'center'</code></td>
  463. <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>
  464. </tr>
  465. <tr>
  466. <td>autoResize</td>
  467. <td>boolean</td>
  468. <td><code>true</code></td>
  469. <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>
  470. </tr>
  471. <tr>
  472. <td>clickToUse</td>
  473. <td>boolean</td>
  474. <td><code>false</code></td>
  475. <td>When a Timeline is configured to be <code>clickToUse</code>, it will react to mouse and touch events only when active.
  476. 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>
  477. </tr>
  478. <tr>
  479. <td>configure</td>
  480. <td>boolean or function</td>
  481. <td><code>false</code></td>
  482. <td>When true, a configurator is loaded where all configuration options of the Timeline can be changed live.
  483. 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:
  484. <pre class="prettyprint lang-js">
  485. function (option, path) {
  486. return option === 'format' || path.indexOf('format') !== -1;
  487. }</pre>
  488. </td>
  489. </tr>
  490. <tr>
  491. <td>dataAttributes</td>
  492. <td>string[] or 'all'</string></td>
  493. <td><code>false</code></td>
  494. <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>
  495. If value is <code>'all'</code> then each field defined on the timeline item will become a <code>data-</code> attribute.</td>
  496. </tr>
  497. <tr class='toggle collapsible' onclick="toggleTable('optionTable','editable', this);">
  498. <td><span parent="editable" class="right-caret"></span> editable</td>
  499. <td>boolean or Object</td>
  500. <td><code>false</code></td>
  501. <td>If true, the items in the timeline can be manipulated. Only applicable when option <code>selectable</code> is <code><code>true</code></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.
  502. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.
  503. </td>
  504. </tr>
  505. <tr parent="editable" class="hidden">
  506. <td class="indent">editable.add</td>
  507. <td>boolean</td>
  508. <td><code>false</code></td>
  509. <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>
  510. </tr>
  511. <tr parent="editable" class="hidden">
  512. <td class="indent">editable.remove</td>
  513. <td>boolean</td>
  514. <td><code>false</code></td>
  515. <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>
  516. </tr>
  517. <tr parent="editable" class="hidden">
  518. <td class="indent">editable.updateGroup</td>
  519. <td>boolean</td>
  520. <td><code>false</code></td>
  521. <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>
  522. </tr>
  523. <tr parent="editable" class="hidden">
  524. <td class="indent">editable.updateTime</td>
  525. <td>boolean</td>
  526. <td><code>false</code></td>
  527. <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>
  528. </tr>
  529. <tr parent="editable" class="hidden">
  530. <td class="indent">editable.overrideItems</td>
  531. <td>boolean</td>
  532. <td><code>false</code></td>
  533. <td>If true, item specific editable properties are overridden by timeline settings</td>
  534. </tr>
  535. <tr>
  536. <td>end</td>
  537. <td>Date or Number or String or Moment</td>
  538. <td>none</td>
  539. <td>The initial end date for the axis of the timeline.
  540. If not provided, the latest date present in the items set is taken as
  541. end date.</td>
  542. </tr>
  543. <tr>
  544. <td>format</td>
  545. <td>Object or Function</td>
  546. <td>none</td>
  547. <td>
  548. Apply custom date formatting of the labels on the time axis. The default value of <code>format</code> is:
  549. <pre class="prettyprint lang-js">{
  550. minorLabels: {
  551. millisecond:'SSS',
  552. second: 's',
  553. minute: 'HH:mm',
  554. hour: 'HH:mm',
  555. weekday: 'ddd D',
  556. day: 'D',
  557. week: 'w',
  558. month: 'MMM',
  559. year: 'YYYY'
  560. },
  561. majorLabels: {
  562. millisecond:'HH:mm:ss',
  563. second: 'D MMMM HH:mm',
  564. minute: 'ddd D MMMM',
  565. hour: 'ddd D MMMM',
  566. weekday: 'MMMM YYYY',
  567. day: 'MMMM YYYY',
  568. week: 'MMMM YYYY',
  569. month: 'YYYY',
  570. year: ''
  571. }
  572. }</pre>
  573. For values which not provided in the customized <code>options.format</code>, the default values will be used.
  574. All available formatting syntax is described in the <a href="http://momentjs.com/docs/#/displaying/format/">docs of moment.js</a>.
  575. <br>
  576. 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.
  577. <pre class="prettyprint lang-js">function format({
  578. minorLabels: Function(date: Date, scale: Number, step: Number),
  579. majorLabels: Function(date: Date, scale: Number, step: Number)
  580. }</pre>
  581. </td>
  582. </tr>
  583. <tr class='toggle collapsible' onclick="toggleTable('optionTable','groupEditable', this);">
  584. <td><span parent="groupEditable" class="right-caret"></span> groupEditable</td>
  585. <td>boolean or Object</td>
  586. <td><code>false</code></td>
  587. <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.
  588. The editing of groups follows the same principles as for items, see section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.
  589. </td>
  590. </tr>
  591. <tr parent="groupEditable" class="hidden">
  592. <td class="indent">groupEditable.add</td>
  593. <td>boolean</td>
  594. <td><code>false</code></td>
  595. <td>If true, new groups can be created in the Timeline. For now adding new groups is done by the user.</td>
  596. </tr>
  597. <tr parent="groupEditable" class="hidden">
  598. <td class="indent">groupEditable.remove</td>
  599. <td>boolean</td>
  600. <td><code>false</code></td>
  601. <td>If true, groups can be deleted. For now removing groups is done by the user.</td>
  602. </tr>
  603. <tr parent="groupEditable" class="hidden">
  604. <td class="indent">groupEditable.order</td>
  605. <td>boolean</td>
  606. <td><code>false</code></td>
  607. <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>
  608. </tr>
  609. <tr>
  610. <td>groupOrder</td>
  611. <td>String or Function</td>
  612. <td>'order'</td>
  613. <td>Order the groups by a field name or custom sort function.
  614. By default, groups are ordered by a property <code>order</code> (if set).
  615. If no <code>order</code> properties are provided, the order will be undetermined.
  616. </td>
  617. </tr>
  618. <tr>
  619. <td>groupOrderSwap</td>
  620. <td>Function</td>
  621. <td>none</td>
  622. <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.
  623. 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:
  624. <pre class="prettyprint lang-js">function groupOrderSwap(fromGroup: Object, toGroup: Object, groups: DataSet)</pre>
  625. 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.
  626. </td>
  627. </tr>
  628. <tr>
  629. <td>groupTemplate</td>
  630. <td>function</td>
  631. <td>none</td>
  632. <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>
  633. </tr>
  634. <tr>
  635. <td>height</td>
  636. <td>number or String</td>
  637. <td>none</td>
  638. <td>The height of the timeline in pixels or as a percentage.
  639. When height is undefined or null, the height of the timeline is automatically
  640. adjusted to fit the contents.
  641. It is possible to set a maximum height using option <code>maxHeight</code>
  642. to prevent the timeline from getting too high in case of automatically
  643. calculated height.
  644. </td>
  645. </tr>
  646. <tr>
  647. <td>hiddenDates</td>
  648. <td>Object</td>
  649. <td>none</td>
  650. <td>This option allows you to hide specific timespans from the time axis. The dates can be supplied as an object:
  651. <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.
  652. 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
  653. and set repeat to weekly.
  654. </td>
  655. </tr>
  656. <tr>
  657. <td>horizontalScroll</td>
  658. <td>Boolean</td>
  659. <td>false</td>
  660. <td>This option allows you to scroll horizontally to move backwards and forwards in the time range.
  661. Only applicable when option <code>zoomCtrl</code> is defined or <code>zoomable</code> is <code>false</code>. Notice that defining this option as <code>true</code> will override <code>verticalScroll</code> scroll event but not eliminate the vertical scrollbar.
  662. </td>
  663. </tr>
  664. <tr>
  665. <td>itemsAlwaysDraggable</td>
  666. <td>boolean</td>
  667. <td><code>false</code></td>
  668. <td>If true, all items in the Timeline are draggable without being selected. If false, only the selected item(s) are draggable.</td>
  669. </tr>
  670. <tr>
  671. <td>locale</td>
  672. <td>String</td>
  673. <td>none</td>
  674. <td>Select a locale for the Timeline. See section <a href="#Localization">Localization</a> for more information.</td>
  675. </tr>
  676. <tr>
  677. <td>locales</td>
  678. <td>Object</td>
  679. <td>none</td>
  680. <td>A map with i18n locales. See section <a href="#Localization">Localization</a> for more information.</td>
  681. </tr>
  682. <tr>
  683. <td>moment</td>
  684. <td>function</td>
  685. <td>vis.moment</td>
  686. <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>
  687. </tr>
  688. <tr class='toggle collapsible' onclick="toggleTable('optionTable','margin', this);">
  689. <td><span parent="margin" class="right-caret"></span> margin</td>
  690. <td>number or Object</td>
  691. <td>Object</td>
  692. <td>When a number, applies the margin to <code>margin.axis</code>, <code>margin.item.horizontal</code>, and <code>margin.item.vertical</code>.</td>
  693. </tr>
  694. <tr parent="margin" class="hidden">
  695. <td class="indent">margin.axis</td>
  696. <td>number</td>
  697. <td><code>20</code></td>
  698. <td>The minimal margin in pixels between items and the time axis.</td>
  699. </tr>
  700. <tr parent="margin" class="hidden">
  701. <td class="indent">margin.item</td>
  702. <td>number</td>
  703. <td><code>10</code></td>
  704. <td>The minimal margin in pixels between items in both horizontal and vertical direction.</td>
  705. </tr>
  706. <tr parent="margin" class="hidden">
  707. <td class="indent2">margin.item.horizontal</td>
  708. <td>number</td>
  709. <td><code>10</code></td>
  710. <td>The minimal horizontal margin in pixels between items.</td>
  711. </tr>
  712. <tr parent="margin" class="hidden">
  713. <td class="indent2">margin.item.vertical</td>
  714. <td>number</td>
  715. <td><code>10</code></td>
  716. <td>The minimal vertical margin in pixels between items.</td>
  717. </tr>
  718. <tr>
  719. <td>max</td>
  720. <td>Date or Number or String or Moment</td>
  721. <td>none</td>
  722. <td>Set a maximum Date for the visible range.
  723. It will not be possible to move beyond this maximum.
  724. </td>
  725. </tr>
  726. <tr>
  727. <td>maxHeight</td>
  728. <td>number or String</td>
  729. <td>none</td>
  730. <td>Specifies the maximum height for the Timeline. Can be a number in pixels or a string like "300px".</td>
  731. </tr>
  732. <tr>
  733. <td>maxMinorChars</td>
  734. <td>number</td>
  735. <td>7</td>
  736. <td>
  737. Specifies the maximum number of characters that should fit in minor grid labels.
  738. If larger, less and wider grids will be drawn.
  739. </td>
  740. </tr>
  741. <tr>
  742. <td>min</td>
  743. <td>Date or Number or String or Moment</td>
  744. <td>none</td>
  745. <td>Set a minimum Date for the visible range.
  746. It will not be possible to move beyond this minimum.
  747. </td>
  748. </tr>
  749. <tr>
  750. <td>minHeight</td>
  751. <td>number or String</td>
  752. <td>none</td>
  753. <td>Specifies the minimum height for the Timeline. Can be a number in pixels or a string like "300px".</td>
  754. </tr>
  755. <tr>
  756. <td>moveable</td>
  757. <td>boolean</td>
  758. <td><code>true</code></td>
  759. <td>
  760. Specifies whether the Timeline can be moved and zoomed by dragging the window.
  761. See also option <code>zoomable</code>.
  762. </td>
  763. </tr>
  764. <tr>
  765. <td>multiselect</td>
  766. <td>boolean</td>
  767. <td><code>false</code></td>
  768. <td>
  769. If true, multiple items can be selected using ctrl+click, shift+click, or by holding items.
  770. Only applicable when option <code>selectable</code> is <code>true</code>.
  771. </td>
  772. </tr>
  773. <tr>
  774. <td style="font-size: 0.9em">multiselectPerGroup</td>
  775. <td>boolean</td>
  776. <td><code>false</code></td>
  777. <td>
  778. If true, selecting multiple items using shift+click will only select items residing in the same group as the <i>first</i> selected item.
  779. Only applicable when option <code>selectable</code> and <code>multiselect</code> are <code>true</code>.
  780. </td>
  781. </tr>
  782. <tr>
  783. <td>onAdd</td>
  784. <td>function</td>
  785. <td>none</td>
  786. <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><code>true</code></code>.
  787. </td>
  788. </tr>
  789. <tr>
  790. <td>onAddGroup</td>
  791. <td>function</td>
  792. <td>none</td>
  793. <td>Callback function triggered when a group is about to be added. The signature and semantics are the same as for <code>onAdd</code>.
  794. </td>
  795. </tr>
  796. <tr>
  797. <td>onUpdate</td>
  798. <td>function</td>
  799. <td>none</td>
  800. <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><code>true</code></code>.
  801. </td>
  802. </tr>
  803. <tr>
  804. <td>onMove</td>
  805. <td>function</td>
  806. <td>none</td>
  807. <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><code>true</code></code>.
  808. </td>
  809. </tr>
  810. <tr>
  811. <td>onMoveGroup</td>
  812. <td>function</td>
  813. <td>none</td>
  814. <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>.
  815. </td>
  816. </tr>
  817. <tr>
  818. <td>onMoving</td>
  819. <td>function</td>
  820. <td>none</td>
  821. <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><code>true</code></code>.
  822. </td>
  823. </tr>
  824. <tr>
  825. <td>onRemove</td>
  826. <td>function</td>
  827. <td>none</td>
  828. <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><code>true</code></code>.
  829. </td>
  830. </tr>
  831. <tr>
  832. <td>onRemoveGroup</td>
  833. <td>function</td>
  834. <td>none</td>
  835. <td>Callback function triggered when a group is about to be removed. The signature and semantics are the same as for <code>onRemove</code>.
  836. </td>
  837. </tr>
  838. <tr>
  839. <td>order</td>
  840. <td>function</td>
  841. <td>none</td>
  842. <td>
  843. <p>Provide a custom sort function to order the items. The order of the
  844. items is determining the way they are stacked. The function
  845. order is called with two arguments containing the data of two items to be
  846. compared.
  847. </p>
  848. <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>
  849. </td>
  850. </tr>
  851. <tr class='toggle collapsible' onclick="toggleTable('optionTable','orientation', this);">
  852. <td><span parent="orientation" class="right-caret"></span> orientation</td>
  853. <td>String or Object</td>
  854. <td><code>'bottom'</code></td>
  855. <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>
  856. </tr>
  857. <tr parent="orientation" class="hidden">
  858. <td class="indent">orientation.axis</td>
  859. <td>String</td>
  860. <td><code>'bottom'</code></td>
  861. <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>
  862. </tr>
  863. <tr parent="orientation" class="hidden">
  864. <td class="indent">orientation.item</td>
  865. <td>String</td>
  866. <td><code>'bottom'</code></td>
  867. <td>Orientation of the timeline items: 'top' or 'bottom' (default). Determines whether items are aligned to the top or bottom of the Timeline.</td>
  868. </tr>
  869. <tr class='toggle collapsible' onclick="toggleTable('optionTable','rollingMode', this);">
  870. <td><span parent="rollingMode" class="right-caret"></span> rollingMode</td>
  871. <td>Object</td>
  872. <td><code>Object</code></td>
  873. <td>Specify how the timeline implements rolling mode.</td>
  874. </tr>
  875. <tr parent="rollingMode" class="hidden">
  876. <td class="indent">rollingMode.follow</td>
  877. <td>boolean</td>
  878. <td><code>false</code></td>
  879. <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>
  880. </tr>
  881. <tr parent="rollingMode" class="hidden">
  882. <td class="indent">rollingMode.offset</td>
  883. <td>Number</td>
  884. <td><code>'0.5'</code></td>
  885. <td>
  886. Set how far from the left the rolling mode is implemented from. A percentage (i.e. a decimal between 0 and 1)
  887. Defaults to the middle or 0.5 (50%)
  888. </td>
  889. </tr>
  890. <tr>
  891. <td>rtl</td>
  892. <td>boolean</td>
  893. <td><code>false</code></td>
  894. <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>
  895. </tr>
  896. <tr>
  897. <td>selectable</td>
  898. <td>boolean</td>
  899. <td><code>true</code></td>
  900. <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>
  901. </tr>
  902. <tr>
  903. <td>showCurrentTime</td>
  904. <td>boolean</td>
  905. <td><code>true</code></td>
  906. <td>Show a vertical bar at the current time.</td>
  907. </tr>
  908. <tr>
  909. <tr>
  910. <td>showMajorLabels</td>
  911. <td>boolean</td>
  912. <td><code>true</code></td>
  913. <td>By default, the timeline shows both minor and major date labels on the
  914. time axis.
  915. For example the minor labels show minutes and the major labels show hours.
  916. When <code>showMajorLabels</code> is <code><code>false</code></code>, no major labels
  917. are shown.</td>
  918. </tr>
  919. <tr>
  920. <td>showMinorLabels</td>
  921. <td>boolean</td>
  922. <td><code>true</code></td>
  923. <td>By default, the timeline shows both minor and major date labels on the
  924. time axis.
  925. For example the minor labels show minutes and the major labels show hours.
  926. When <code>showMinorLabels</code> is <code><code>false</code></code>, no minor labels
  927. are shown. When both <code>showMajorLabels</code> and
  928. <code>showMinorLabels</code> are false, no horizontal axis will be
  929. visible.</td>
  930. </tr>
  931. <tr>
  932. <td>stack</td>
  933. <td>boolean</td>
  934. <td><code>true</code></td>
  935. <td>If true (default), items will be stacked on top of each other such that they do not overlap.</td>
  936. </tr>
  937. <tr>
  938. <td>stackSubgroups</td>
  939. <td>boolean</td>
  940. <td><code>true</code></td>
  941. <td>If true (default), subgroups will be stacked on top of each other such that they do not overlap.</td>
  942. </tr>
  943. <tr>
  944. <td>snap</td>
  945. <td>function or null</td>
  946. <td>function</td>
  947. <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:
  948. <pre class="prettyprint lang-js">function snap(date: Date, scale: string, step: number) : Date or number</pre>
  949. The parameter <code>scale</code> can be can be 'millisecond', 'second', 'minute', 'hour', 'weekday, 'week', 'day, 'month, or 'year'. The parameter <code>step</code> is a number like 1, 2, 4, 5.
  950. </td>
  951. </tr>
  952. <tr>
  953. <td>start</td>
  954. <td>Date or Number or String or Moment</td>
  955. <td>none</td>
  956. <td>The initial start date for the axis of the timeline.
  957. If not provided, the earliest date present in the events is taken as start date.</td>
  958. </tr>
  959. <tr>
  960. <td>template</td>
  961. <td>function</td>
  962. <td>none</td>
  963. <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>
  964. </tr>
  965. <tr>
  966. <td>visibleFrameTemplate</td>
  967. <td>function</td>
  968. <td>none</td>
  969. <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.
  970. 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>
  971. </tr>
  972. <tr class='deprecated'>
  973. <td>throttleRedraw</td>
  974. <td>number</td>
  975. <td><code>0</code></td>
  976. <td>This option is <b>DEPRECATED</b> and no longer supported. It will be removed in the next MAJOR release.</td>
  977. </tr>
  978. <tr class='toggle collapsible' onclick="toggleTable('optionTable','timeAxis', this);">
  979. <td><span parent="timeAxis" class="right-caret"></span> timeAxis</td>
  980. <td>Object</td>
  981. <td><code>Object</code></td>
  982. <td>Specify a fixed scale and step size for the time axis.</td>
  983. </tr>
  984. <tr parent="timeAxis" class="hidden">
  985. <td class="indent">timeAxis.scale</td>
  986. <td>String</td>
  987. <td>none</td>
  988. <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>'year'</code>. Example usage:
  989. <pre class="prettyprint lang-js">var options = {
  990. timeAxis: {scale: 'minute', step: 5}
  991. }</pre>
  992. <p>Note: The 'week' scale only works properly when <a href="#Localization">locales</a> are enabled.</p>
  993. </td>
  994. </tr>
  995. <tr parent="timeAxis" class="hidden">
  996. <td class="indent">timeAxis.step</td>
  997. <td>number</td>
  998. <td><code>1</code></td>
  999. <td>
  1000. Set a fixed step size for the time axis. Only applicable when used together with <code>timeAxis.scale</code>.
  1001. Choose for example 1, 2, 5, or 10.</td>
  1002. </tr>
  1003. <tr>
  1004. <td>type</td>
  1005. <td>String</td>
  1006. <td>none</td>
  1007. <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.
  1008. </td>
  1009. </tr>
  1010. <tr class='toggle collapsible' onclick="toggleTable('optionTable','tooltip', this);">
  1011. <td><span parent="tooltip" class="right-caret"></span> tooltip</td>
  1012. <td>Object</td>
  1013. <td><code>Object</code></td>
  1014. <td>Specify how the tooltip is positioned.</td>
  1015. </tr>
  1016. <tr parent="tooltip" class="hidden">
  1017. <td class="indent">tooltip.followMouse</td>
  1018. <td>boolean</td>
  1019. <td><code>false</code></td>
  1020. <td>If true, tooltips will follow the mouse as they move around in the item.</td>
  1021. </tr>
  1022. <tr parent="tooltip" class="hidden">
  1023. <td class="indent">tooltip.overflowMethod</td>
  1024. <td>String</td>
  1025. <td><code>'flip'</code></td>
  1026. <td>
  1027. Set how the tooltip should act if it is about to overflow out of the timeline.<br />
  1028. Choose from <code>'cap'</code> and <code>'flip'</code>. <br />
  1029. If it is set to <code>'cap'</code>, the tooltip will just cap its position to inside to timeline. <br />
  1030. 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 />
  1031. </tr>
  1032. <tr class='toggle collapsible' onclick="toggleTable('optionTable','tooltipOnItemUpdateTime', this);">
  1033. <td><span parent="tooltipOnItemUpdateTime" class="right-caret"></span> tooltipOnItemUpdateTime</td>
  1034. <td>Object/Boolean</td>
  1035. <td><code>false</code></td>
  1036. <td>Show a tooltip on updating an item's time. Note: <code>editable.updateTime</code> must be <code>true</code></td>
  1037. </tr>
  1038. <tr parent="tooltipOnItemUpdateTime" class="hidden">
  1039. <td class="indent">template</td>
  1040. <td>Function</td>
  1041. <td>none</td>
  1042. <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.
  1043. </td>
  1044. </tr>
  1045. <tr>
  1046. <td>verticalScroll</td>
  1047. <td>Boolean</td>
  1048. <td><code>false</code></td>
  1049. <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
  1050. </td>
  1051. </tr>
  1052. <tr>
  1053. <td>width</td>
  1054. <td>String or Number</td>
  1055. <td><code>'100%'</code></td>
  1056. <td>The width of the timeline in pixels or as a percentage.</td>
  1057. </tr>
  1058. <tr>
  1059. <td>zoomable</td>
  1060. <td>boolean</td>
  1061. <td><code>true</code></td>
  1062. <td>
  1063. Specifies whether the Timeline can be zoomed by pinching or scrolling in the window.
  1064. Only applicable when option <code>moveable</code> is set <code><code>true</code></code>.
  1065. </td>
  1066. </tr>
  1067. <tr>
  1068. <td>zoomKey</td>
  1069. <td>String</td>
  1070. <td><code>''</code></td>
  1071. <td>Specifies whether the Timeline is only zoomed when an additional key is down.
  1072. Available values are '' (does not apply), 'altKey', 'ctrlKey', or 'metaKey'.
  1073. Only applicable when option <code>moveable</code> is set <code><code>true</code></code>.
  1074. </td>
  1075. </tr>
  1076. <tr>
  1077. <td>zoomMax</td>
  1078. <td>number</td>
  1079. <td><code>315360000000000</code></td>
  1080. <td>Set a maximum zoom interval for the visible range in milliseconds.
  1081. It will not be possible to zoom out further than this maximum.
  1082. Default value equals about 10000 years.
  1083. </td>
  1084. </tr>
  1085. <tr>
  1086. <td>zoomMin</td>
  1087. <td>number</td>
  1088. <td><code>10</code></td>
  1089. <td>Set a minimum zoom interval for the visible range in milliseconds.
  1090. It will not be possible to zoom in further than this minimum.
  1091. </td>
  1092. </tr>
  1093. </table>
  1094. <h2 id="Methods">Methods</h2>
  1095. <p>
  1096. The Timeline supports the following methods.
  1097. </p>
  1098. <table class="methods">
  1099. <tr>
  1100. <th>Method</th>
  1101. <th>Return&nbsp;Type</th>
  1102. <th>Description</th>
  1103. </tr>
  1104. <tr>
  1105. <td>addCustomTime([time] [, id])</td>
  1106. <td>number or String</td>
  1107. <td>
  1108. Add new vertical bar representing a custom time that can be dragged by the user.
  1109. Parameter <code>time</code> can be a Date, Number, or String, and is <code>new Date()</code> by default.
  1110. Parameter <code>id</code> can be Number or String and is <code>undefined</code> by default.
  1111. The <code>id</code>code> is added as CSS class name of the custom time bar, allowing to style multiple time bars differently.
  1112. The method returns id of the created bar.
  1113. </td>
  1114. </tr>
  1115. <tr>
  1116. <td>destroy()</td>
  1117. <td>none</td>
  1118. <td>Destroy the Timeline. The timeline is removed from memory. all DOM elements and event listeners are cleaned up.
  1119. </td>
  1120. </tr>
  1121. <tr>
  1122. <td>fit([options])</td>
  1123. <td>none</td>
  1124. <td>Adjust the visible window such that it fits all items. See also function <code>focus(id)</code>.
  1125. Available options:
  1126. <ul>
  1127. <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>.
  1128. </li>
  1129. </ul>
  1130. </td>
  1131. </tr>
  1132. <tr>
  1133. <td>focus(id or ids [, options])</td>
  1134. <td>none</td>
  1135. <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:
  1136. <ul>
  1137. <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>
  1138. </ul>
  1139. </td>
  1140. </tr>
  1141. <tr>
  1142. <td>getCurrentTime()</td>
  1143. <td>Date</td>
  1144. <td>Get the current time. Only applicable when option <code>showCurrentTime</code> is true.
  1145. </td>
  1146. </tr>
  1147. <tr>
  1148. <td>getCustomTime([id])</td>
  1149. <td>Date</td>
  1150. <td>Retrieve the custom time from the custom time bar with given id. Id is <code>undefined</code> by default.
  1151. </td>
  1152. </tr>
  1153. <tr id="getEventProperties">
  1154. <td>getEventProperties(event)</td>
  1155. <td>Object</td>
  1156. <td>
  1157. Returns an Object with relevant properties from an event:
  1158. <ul>
  1159. <li><code>group</code> (Number or null): the id of the clicked group.</li>
  1160. <li><code>item</code> (Number or null): the id of the clicked item.</li>
  1161. <li><code>pageX</code> (Number): absolute horizontal position of the click event.</li>
  1162. <li><code>pageY</code> (Number): absolute vertical position of the click event.</li>
  1163. <li><code>x</code> (Number): relative horizontal position of the click event.</li>
  1164. <li><code>y</code> (Number): relative vertical position of the click event.</li>
  1165. <li><code>time</code> (Date): Date of the clicked event.</li>
  1166. <li><code>snappedTime</code> (Date): Date of the clicked event, snapped to a nice value.</li>
  1167. <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>
  1168. <li><code>event</code> (Object): the original click event.</li>
  1169. </ul>
  1170. Example usage:
  1171. <pre class="prettyprint lang-js">
  1172. document.getElementById('myTimeline').onclick = function (event) {
  1173. var props = timeline.getEventProperties(event)
  1174. console.log(props);
  1175. }</pre>
  1176. </td>
  1177. </tr>
  1178. <tr>
  1179. <td>getItemRange()</td>
  1180. <td>Object</td>
  1181. <td>Get the range of all the items as an object containing <code>min: Date</code> and <code>max: Date</code>.</td>
  1182. </tr>
  1183. <tr>
  1184. <td>getSelection()</td>
  1185. <td>number[]</td>
  1186. <td>Get an array with the ids of the currently selected items.</td>
  1187. </tr>
  1188. <tr>
  1189. <td>getVisibleItems()</td>
  1190. <td>number[]</td>
  1191. <td>Get an array with the ids of the currently visible items.</td>
  1192. </tr>
  1193. <tr>
  1194. <td>getWindow()</td>
  1195. <td>Object</td>
  1196. <td>Get the current visible window. Returns an object with properties <code>start: Date</code> and <code>end: Date</code>.</td>
  1197. </tr>
  1198. <tr>
  1199. <td>moveTo(time [, options, callback])</td>
  1200. <td>none</td>
  1201. <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:
  1202. <ul>
  1203. <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>
  1204. </ul>
  1205. A callback <code>function</code> can be passed as an optional parameter. This function will be called at the end of moveTo function.
  1206. </td>
  1207. </tr>
  1208. <tr>
  1209. <td>on(event, callback)</td>
  1210. <td>none</td>
  1211. <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>
  1212. </tr>
  1213. <tr>
  1214. <td>off(event, callback)</td>
  1215. <td>none</td>
  1216. <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>
  1217. </tr>
  1218. <tr>
  1219. <td>redraw()</td>
  1220. <td>none</td>
  1221. <td>Force a redraw of the Timeline. The size of all items will be recalculated.
  1222. Can be useful to manually redraw when option <code>autoResize=false</code> and the window
  1223. has been resized, or when the items CSS has been changed.
  1224. </td>
  1225. </tr>
  1226. <tr>
  1227. <td>removeCustomTime(id)</td>
  1228. <td>none</td>
  1229. <td>
  1230. 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.
  1231. </td>
  1232. </tr>
  1233. <tr>
  1234. <td>setCurrentTime(time)</td>
  1235. <td>none</td>
  1236. <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.
  1237. <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
  1238. Only applicable when option <code>showCurrentTime</code> is true.</td>
  1239. </tr>
  1240. <tr>
  1241. <td>setCustomTime(time [, id])</td>
  1242. <td>none</td>
  1243. <td>Adjust the time of a custom time bar.
  1244. Parameter <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
  1245. Parameter <code>id</code> is the id of the custom time bar, and is <code>undefined</code> by default.
  1246. </td>
  1247. </tr>
  1248. <tr>
  1249. <td>setCustomTimeTitle(title [, id])</td>
  1250. <td>none</td>
  1251. <td>Adjust the title attribute of a custom time bar.
  1252. Parameter <code>title</code> is the string or function to be set as title. Use empty string to hide the title completely.
  1253. Parameter <code>id</code> is the id of the custom time bar, and is <code>undefined</code> by default.
  1254. </td>
  1255. </tr>
  1256. <tr>
  1257. <td>setData({<br>&nbsp;&nbsp;groups: groups,<br>&nbsp;&nbsp;items: items<br>})</td>
  1258. <td>none</td>
  1259. <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>.
  1260. Both <code>items</code> and <code>groups</code> can be an Array with Objects,
  1261. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1262. For each of the groups, the items of the timeline are filtered on the
  1263. property <code>group</code>, which must correspond with the id of the group.
  1264. </td>
  1265. </tr>
  1266. <tr>
  1267. <td>setGroups(groups)</td>
  1268. <td>none</td>
  1269. <td>Set a data set with groups for the Timeline.
  1270. <code>groups</code> can be an Array with Objects,
  1271. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1272. For each of the groups, the items of the timeline are filtered on the
  1273. property <code>group</code>, which must correspond with the id of the group.
  1274. </td>
  1275. </tr>
  1276. <tr>
  1277. <td>setItems(items)</td>
  1278. <td>none</td>
  1279. <td>Set a data set with items for the Timeline.
  1280. <code>items</code> can be an Array with Objects,
  1281. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1282. </td>
  1283. </tr>
  1284. <tr>
  1285. <td>setOptions(options)</td>
  1286. <td>none</td>
  1287. <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.
  1288. </td>
  1289. </tr>
  1290. <tr>
  1291. <td>setSelection(id or ids [, options])</td>
  1292. <td>none</td>
  1293. <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:
  1294. <ul>
  1295. <li><code>focus: boolean</code><br>If true, focus will be set to the selected item(s)</li>
  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>. 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>
  1297. </ul>
  1298. </td>
  1299. </tr>
  1300. <tr>
  1301. <td>setWindow(start, end [, options, callback])</td>
  1302. <td>none</td>
  1303. <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:
  1304. <ul>
  1305. <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>
  1306. </ul>
  1307. A callback <code>function</code> can be passed as an optional parameter. This function will be called at the end of setWindow function.
  1308. </td>
  1309. </tr>
  1310. <tr>
  1311. <td>toggleRollingMode()</td>
  1312. <td>none</td>
  1313. <td>Toggle rollingMode.
  1314. </td>
  1315. </tr>
  1316. <tr>
  1317. <td>zoomIn(percentage [, options, callback])</td>
  1318. <td>none</td>
  1319. <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:
  1320. <ul>
  1321. <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>
  1322. </ul>
  1323. A callback <code>function</code> can be passed as an optional parameter. This function will be called at the end of zoomIn function.
  1324. </td>
  1325. </tr>
  1326. <tr>
  1327. <td>zoomOut(percentage [, options, callback])</td>
  1328. <td>none</td>
  1329. <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:
  1330. <ul>
  1331. <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>
  1332. </ul>
  1333. A callback <code>function</code> can be passed as an optional parameter. This function will be called at the end of zoomOut function.
  1334. </td>
  1335. </tr>
  1336. </table>
  1337. <h2 id="Events">Events</h2>
  1338. <p>
  1339. Timeline fires events when changing the visible window by dragging, when
  1340. selecting items, and when dragging the custom time bar.
  1341. </p>
  1342. <p>
  1343. Here an example on how to listen for a <code>select</code> event.
  1344. </p>
  1345. <pre class="prettyprint lang-js">
  1346. timeline.on('select', function (properties) {
  1347. alert('selected items: ' + properties.items);
  1348. });
  1349. </pre>
  1350. <p>
  1351. A listener can be removed via the function <code>off</code>:
  1352. </p>
  1353. <pre class="prettyprint lang-js">
  1354. function onSelect (properties) {
  1355. alert('selected items: ' + properties.items);
  1356. }
  1357. // add event listener
  1358. timeline.on('select', onSelect);
  1359. // do stuff...
  1360. // remove event listener
  1361. timeline.off('select', onSelect);
  1362. </pre>
  1363. <p>
  1364. The following events are available.
  1365. </p>
  1366. <table class="events">
  1367. <tr>
  1368. <th>Name</th>
  1369. <th>Properties</th>
  1370. <th>Description</th>
  1371. </tr>
  1372. <tr>
  1373. <td>currentTimeTick</td>
  1374. <td>Fired when the current time bar redraws. The rate depends on the zoom level.</td>
  1375. </tr>
  1376. <tr>
  1377. <td>click</td>
  1378. <td>
  1379. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1380. </td>
  1381. <td>Fired when clicked inside the Timeline.
  1382. </td>
  1383. </tr>
  1384. <tr>
  1385. <td>contextmenu</td>
  1386. <td>
  1387. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1388. </td>
  1389. <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:
  1390. <pre class="prettyprint lang-js">timeline.on('contextmenu', function (props) {
  1391. alert('Right click!');
  1392. props.event.preventDefault();
  1393. });
  1394. </pre>
  1395. </td>
  1396. </tr>
  1397. <tr>
  1398. <td>doubleClick</td>
  1399. <td>
  1400. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1401. </td>
  1402. <td>Fired when double clicked inside the Timeline.
  1403. </td>
  1404. </tr>
  1405. <tr>
  1406. <td>drop</td>
  1407. <td>
  1408. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1409. </td>
  1410. <td>Fired when dropping inside the Timeline.
  1411. </td>
  1412. </tr>
  1413. <tr>
  1414. <td>mouseOver</td>
  1415. <td>
  1416. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1417. </td>
  1418. <td>Fired when the mouse hovers over a timeline element.
  1419. </td>
  1420. </tr>
  1421. <tr>
  1422. <td>mouseDown</td>
  1423. <td>
  1424. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1425. </td>
  1426. <td>Fired when the mouse down event is triggered over a timeline element.
  1427. </td>
  1428. </tr>
  1429. <tr>
  1430. <td>mouseUp</td>
  1431. <td>
  1432. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1433. </td>
  1434. <td>Fired when the mouse up event is triggered over a timeline element.
  1435. </td>
  1436. </tr>
  1437. <tr>
  1438. <td>mouseMove</td>
  1439. <td>
  1440. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1441. </td>
  1442. <td>Fired when the mouse is moved over a timeline element.
  1443. </td>
  1444. </tr>
  1445. <tr>
  1446. <td>groupDragged</td>
  1447. <td>
  1448. Passes the id of the dragged group.
  1449. </td>
  1450. <td>Fired after the dragging of a group is finished.
  1451. </td>
  1452. </tr>
  1453. <tr>
  1454. <td>changed</td>
  1455. <td>
  1456. Has no properties.
  1457. </td>
  1458. <td>Fired once after each graph redraw.
  1459. </td>
  1460. </tr>
  1461. <tr>
  1462. <td>rangechange</td>
  1463. <td>
  1464. <ul>
  1465. <li><code>start</code> (Number): timestamp of the current start of the window.</li>
  1466. <li><code>end</code> (Number): timestamp of the current end of the window.</li>
  1467. <li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
  1468. <li><code>event</code> (Object): original event triggering the rangechange.</li>
  1469. </ul>
  1470. </td>
  1471. <td>Fired repeatedly when the timeline window is being changed.
  1472. </td>
  1473. </tr>
  1474. <tr>
  1475. <td>rangechanged</td>
  1476. <td>
  1477. <ul>
  1478. <li><code>start</code> (Number): timestamp of the current start of the window.</li>
  1479. <li><code>end</code> (Number): timestamp of the current end of the window.</li>
  1480. <li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
  1481. <li><code>event</code> (Object): original event triggering the rangechanged.</li>
  1482. </ul>
  1483. </td>
  1484. <td>Fired once after the timeline window has been changed.
  1485. </td>
  1486. </tr>
  1487. <tr>
  1488. <td>select</td>
  1489. <td>
  1490. <ul>
  1491. <li><code>items</code>: an array with the ids of the selected items</li>
  1492. <li><code>event</code>: the original click event</li>
  1493. </ul>
  1494. </td>
  1495. <td>Fired after the user selects or deselects items by tapping or holding them.
  1496. When a user taps an already selected item, the select event is fired again.
  1497. Not fired when the method <code>setSelection</code>is executed.
  1498. </td>
  1499. </tr>
  1500. <tr>
  1501. <td>itemover</td>
  1502. <td>
  1503. <ul>
  1504. <li><code>item</code>: hovered item id</li>
  1505. <li><code>event</code>: the original mouseover event</li>
  1506. </ul>
  1507. </td>
  1508. <td>Fired when the user moves the mouse over an item.</td>
  1509. </tr>
  1510. <tr>
  1511. <td>itemout</td>
  1512. <td>
  1513. <ul>
  1514. <li><code>item</code>: hovered item id</li>
  1515. <li><code>event</code>: the original mouseout event</li>
  1516. </ul>
  1517. </td>
  1518. <td>Fired when the user moves the mouse out of an item.</td>
  1519. </tr>
  1520. <tr>
  1521. <td>timechange</td>
  1522. <td>
  1523. <ul>
  1524. <li><code>id</code> (Number or String): custom time bar id.</li>
  1525. <li><code>time</code> (Date): the custom time.</li>
  1526. <li><code>event</code> (Object): original event triggering the timechange.</li>
  1527. </ul>
  1528. </td>
  1529. <td>Fired repeatedly when the user is dragging the custom time bar.
  1530. Only available when the custom time bar is enabled.
  1531. </td>
  1532. </tr>
  1533. <tr>
  1534. <td>timechanged</td>
  1535. <td>
  1536. <ul>
  1537. <li><code>id</code> (Number or String): custom time bar id.</li>
  1538. <li><code>time</code> (Date): the custom time.</li>
  1539. <li><code>event</code> (Object): original event triggering the timechanged.</li>
  1540. </ul>
  1541. </td>
  1542. <td>Fired once after the user has dragged the custom time bar.
  1543. Only available when the custom time bar is enabled.
  1544. </td>
  1545. </tr>
  1546. </table>
  1547. <h2 id="Editing_Items">Editing Items</h2>
  1548. <p>
  1549. When the Timeline is configured to be editable (both options <code>selectable</code> and <code>editable</code> are <code><code>true</code></code>), the user can:
  1550. </p>
  1551. <ul>
  1552. <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>
  1553. <li>Move selected items by dragging them.</li>
  1554. <li>Create a new item by double tapping on an empty space.</li>
  1555. <li>Create a new range item by dragging on an empty space with the ctrl key down.</li>
  1556. <li>Update an item by double tapping it.</li>
  1557. <li>Delete a selected item by clicking the delete button on the top right.</li>
  1558. </ul>
  1559. <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>
  1560. <pre class="prettyprint lang-js">// enable or disable all manipulation actions
  1561. var options = {
  1562. editable: true // true or false
  1563. };
  1564. // enable or disable individual manipulation actions
  1565. var options = {
  1566. editable: {
  1567. add: true, // add new items by double tapping
  1568. updateTime: true, // drag items horizontally
  1569. updateGroup: true, // drag items from one group to another
  1570. remove: true, // delete an item by tapping the delete button top right
  1571. overrideItems: false // allow these options to override item.editable
  1572. }
  1573. };</pre>
  1574. <p>
  1575. 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>.
  1576. </p>
  1577. <pre class="prettyprint lang-js">
  1578. var items = new vis.DataSet([
  1579. {id: 1, content: 'read-only item', start: '2013-04-20', editable: false},
  1580. {id: 2, content: 'editable item', start: '2013-04-14'}
  1581. ]);
  1582. </pre>
  1583. <p>
  1584. 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
  1585. 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
  1586. 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
  1587. in future major releases, and code that specifies all item level values will handle major release changes better. That is, instead of using
  1588. <code>editable: {updateTime : true}</code>, use <code>editable: {updateTime : true, updateGroup: false, remove: false}</code>.
  1589. </p>
  1590. <p>
  1591. One can specify callback functions to validate changes made by the user. There are a number of callback functions for this purpose:
  1592. </p>
  1593. <ul>
  1594. <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>
  1595. <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>
  1596. <li><code>onMove(item, callback)</code> Fired when an item has been moved. If not implemented, the move action will be accepted.</li>
  1597. <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>
  1598. <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>
  1599. </ul>
  1600. <p>
  1601. Each of the callbacks is invoked with two arguments:
  1602. </p>
  1603. <ul>
  1604. <li><code>item</code>: the item being manipulated</li>
  1605. <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>.
  1606. 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`
  1607. 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>
  1608. </ul>
  1609. <p>
  1610. Example code:
  1611. </p>
  1612. <pre class="prettyprint lang-js">var options = {
  1613. onUpdate: function (item, callback) {
  1614. item.content = prompt('Edit items text:', item.content);
  1615. if (item.content != null) {
  1616. callback(item); // send back adjusted item
  1617. }
  1618. else {
  1619. callback(null); // cancel updating the item
  1620. }
  1621. }
  1622. };
  1623. </pre>
  1624. A full example is available here: <a href="../../examples/timeline/editing/editingItemsCallbacks.html">editingItemsCallbacks.html</a>.
  1625. <h2 id="Templates">Templates</h2>
  1626. <p>
  1627. 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:
  1628. </p>
  1629. <pre class="prettyprint lang-js">var options = {
  1630. template: function (item, element, data) {
  1631. var html = ... // generate HTML markup for this item
  1632. return html;
  1633. }
  1634. };
  1635. </pre>
  1636. <h3>Create HTML manually</h3>
  1637. The HTML for an item can be created manually:
  1638. <pre class="prettyprint lang-js">var options = {
  1639. template: function (item, element, data) {
  1640. return '&lt;h1&gt;' + item.header + data.moving?' '+ data.start:'' + '&lt;/h1&gt;&lt;p&gt;' + item.description + '&lt;/p&gt;';
  1641. },
  1642. onMoving: function (item, callback) {
  1643. item.moving = true;
  1644. }
  1645. };
  1646. </pre>
  1647. <h3>Using a template engine</h3>
  1648. Using <a href="http://handlebarsjs.com/">handlebars</a>, one can write the template in HTML:
  1649. <pre class="prettyprint lang-html">
  1650. &lt;script id="item-template" type="text/x-handlebars-template"&gt;
  1651. &lt;h1&gt;{{header}}&lt;/h1&gt;
  1652. &lt;p&gt;{{description}}&lt;/p&gt;
  1653. &lt;/script&gt;
  1654. </pre>
  1655. Compile the template:
  1656. <pre class="prettyprint lang-js">
  1657. var source = document.getElementById('item-template').innerHTML;
  1658. var template = Handlebars.compile(source);
  1659. </pre>
  1660. And then specify the template in the Timeline options
  1661. <pre class="prettyprint lang-js">var options = {
  1662. template: template
  1663. };
  1664. </pre>
  1665. <h3>React templates</h3>
  1666. You can use a React component for the templates by rendering them to the templates' element directly:
  1667. <pre class="prettyprint lang-js">
  1668. template: function (item, element, data) {
  1669. return ReactDOM.render(&lt;b&gt;{item.content}&lt;/b&gt;, element);
  1670. },
  1671. </pre>
  1672. <h3>Multiple templates</h3>
  1673. In order to support multiple templates, the template handler can be extended to switch between different templates, depending on a specific item property:
  1674. <pre class="prettyprint lang-js">
  1675. var templates = {
  1676. template1: Handlebars.compile(...),
  1677. template2: Handlebars.compile(...),
  1678. template2: Handlebars.compile(...),
  1679. ...
  1680. };
  1681. var options = {
  1682. template: function (item, element, data) {
  1683. var template = templates[item.template]; // choose the right template
  1684. return template(item); // execute the template
  1685. }
  1686. };
  1687. </pre>
  1688. Now the items can be extended with a property <code>template</code>, specifying which template to use for the item.
  1689. <h2 id="Localization">Localization</h2>
  1690. <p>
  1691. 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.
  1692. </p>
  1693. <p>
  1694. To set a locale for the Timeline, specify the option <code>locale</code>:
  1695. </p>
  1696. <pre class="prettyprint lang-js">var options = {
  1697. locale: 'nl'
  1698. };
  1699. </pre>
  1700. <h3>Create a new locale</h3>
  1701. 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>:
  1702. <pre class="prettyprint lang-js">var options = {
  1703. locales: {
  1704. // create a new locale (text strings should be replaced with localized strings)
  1705. mylocale: {
  1706. current: 'current',
  1707. time: 'time',
  1708. }
  1709. },
  1710. // use the new locale
  1711. locale: 'mylocale'
  1712. };
  1713. </pre>
  1714. <h3 id="available-locales">Available locales</h3>
  1715. <p>
  1716. Timeline comes with support for the following locales:
  1717. </p>
  1718. <table>
  1719. <tr>
  1720. <th>Language</th>
  1721. <th>Code</th>
  1722. </tr>
  1723. <tr>
  1724. <td>English</td>
  1725. <td>
  1726. <code>en</code><br>
  1727. <code>en_EN</code><br>
  1728. <code>en_US</code>
  1729. </td>
  1730. </tr>
  1731. <tr>
  1732. <td>Italian</td>
  1733. <td>
  1734. <code>it</code><br>
  1735. <code>it_IT</code><br>
  1736. <code>it_CH</code>
  1737. </td>
  1738. </tr>
  1739. <tr>
  1740. <td>Dutch</td>
  1741. <td>
  1742. <code>nl</code><br>
  1743. <code>nl_NL</code><br>
  1744. <code>nl_BE</code>
  1745. </td>
  1746. </tr>
  1747. <tr>
  1748. <td>German</td>
  1749. <td>
  1750. <code>de</code><br>
  1751. <code>de_DE</code><br>
  1752. </td>
  1753. </tr>
  1754. </table>
  1755. <h2 id="Time_zone">Time zone</h2>
  1756. <p>
  1757. 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>.
  1758. </p>
  1759. <p>
  1760. Examples:
  1761. </p>
  1762. <pre class="prettyprint lang-js">// display in UTC
  1763. var options = {
  1764. moment: function(date) {
  1765. return vis.moment(date).utc();
  1766. }
  1767. };
  1768. // display in UTC +08:00
  1769. var options = {
  1770. moment: function(date) {
  1771. return vis.moment(date).utcOffset('+08:00');
  1772. }
  1773. };
  1774. </pre>
  1775. <h2 id="Styles">Styles</h2>
  1776. <p>
  1777. All parts of the Timeline have a class name and a default css style.
  1778. The styles can be overwritten, which enables full customization of the layout
  1779. of the Timeline.
  1780. </p>
  1781. <p>For example, to change the border and background color of all items, include the
  1782. following code inside the head of your html code or in a separate stylesheet.</p>
  1783. <pre class="prettyprint lang-html">&lt;style&gt;
  1784. .vis-item {
  1785. border-color: orange;
  1786. background-color: yellow;
  1787. }
  1788. &lt;/style&gt;
  1789. </pre>
  1790. <h3 id="Grid_Backgrounds">Grid Backgrounds</h3>
  1791. <p>
  1792. The background grid of the time axis can be styled, for example to highlight
  1793. weekends or to create grids with an alternating white/lightgray background.
  1794. </p>
  1795. <p>
  1796. Depending on the zoom level, the grids get certain css classes attached.
  1797. The following classes are available:
  1798. </p>
  1799. <table class="styles">
  1800. <tr>
  1801. <th>Description</th><th>Values</th>
  1802. </tr>
  1803. <tr>
  1804. <td>Alternating columns</td><td><code>vis-even</code>, <code>vis-odd</code></td>
  1805. </tr>
  1806. <tr>
  1807. <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>
  1808. </tr>
  1809. <tr>
  1810. <td>Hours</td><td><code>vis-h0</code>, <code>vis-h1</code>, ..., <code>vis-h23</code></td>
  1811. </tr>
  1812. <tr>
  1813. <td>Grouped hours</td><td><code>vis-h0-h4</code> to <code>vis-h20-h24</code></td>
  1814. </tr>
  1815. <tr>
  1816. <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>
  1817. </tr>
  1818. <tr>
  1819. <td>Days</td><td><code>vis-day1</code>, <code>vis-day2</code>, ..., <code>vis-day31</code></td>
  1820. </tr>
  1821. <tr>
  1822. <td>Week</td><td><code>vis-week1</code>, <code>vis-week2</code>, ..., <code>vis-week53</code></td>
  1823. </tr>
  1824. <tr>
  1825. <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>
  1826. </tr>
  1827. <tr>
  1828. <td>Years</td><td><code>vis-year2014</code>, <code>vis-year2015</code>, ...</td>
  1829. </tr>
  1830. </table>
  1831. <p>
  1832. 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'
  1833. </p>
  1834. <p>Examples:</p>
  1835. <pre class="prettyprint lang-html">&lt;style&gt;
  1836. /* alternating column backgrounds */
  1837. .vis-time-axis .grid.vis-odd {
  1838. background: #f5f5f5;
  1839. }
  1840. /* gray background in weekends, white text color */
  1841. .vis-time-axis .vis-grid.vis-saturday,
  1842. .vis-time-axis .vis-grid.vis-sunday {
  1843. background: gray;
  1844. }
  1845. .vis-time-axis .vis-text.vis-saturday,
  1846. .vis-time-axis .vis-text.vis-sunday {
  1847. color: white;
  1848. }
  1849. &lt;/style&gt;
  1850. </pre>
  1851. </div>
  1852. <!-- Bootstrap core JavaScript
  1853. ================================================== -->
  1854. <!-- Placed at the end of the document so the pages load faster -->
  1855. <script src="../js/jquery.min.js"></script>
  1856. <script src="../js/bootstrap.min.js"></script>
  1857. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  1858. <script src="../js/ie10-viewport-bug-workaround.js"></script>
  1859. <!-- jquery extensions -->
  1860. <script src="../js/jquery.highlight.js"></script>
  1861. <script src="../js/jquery.url.min.js"></script>
  1862. <!-- Tipue vendor js -->
  1863. <script src="../js/tipuesearch.config.js"></script>
  1864. <script src="../js/tipuesearch.js"></script>
  1865. <!-- controller -->
  1866. <script src="../js/main.js"></script>