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.

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