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.

63 lines
2.0 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Individual editable items</title>
  5. <style>
  6. body, html {
  7. font-family: arial, sans-serif;
  8. font-size: 11pt;
  9. }
  10. div.vis-editable,
  11. div.vis-editable.vis-selected {
  12. /* custom styling for editable items... */
  13. }
  14. div.vis-readonly,
  15. div.vis-readonly.vis-selected {
  16. /* custom styling for readonly items... */
  17. background-color: #ff4500;
  18. border-color: red;
  19. color: white;
  20. }
  21. </style>
  22. <script src="../../../dist/vis.js"></script>
  23. <link href="../../../dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
  24. </head>
  25. <body>
  26. <p>Specify individual items to be editable or readonly.</p>
  27. <div id="visualization"></div>
  28. <script>
  29. // create groups to highlight groupUpdate
  30. var groups = new vis.DataSet([
  31. {id: 1, content: 'Group 1'},
  32. {id: 2, content: 'Group 2'}
  33. ]);
  34. // create a DataSet with items
  35. var items = new vis.DataSet([
  36. {id: 1, content: 'Editable', editable: true, start: '2010-08-23', group: 1},
  37. {id: 2, content: 'Editable', editable: true, start: '2010-08-23T23:00:00', group: 2},
  38. {id: 3, content: 'Read-only', editable: false, start: '2010-08-24T16:00:00', group: 1},
  39. {id: 4, content: 'Read-only', editable: false, start: '2010-08-26', end: '2010-09-02', group: 2},
  40. {id: 5, content: 'Edit Time Only', editable: { updateTime: true, updateGroup: false, remove: false }, start: '2010-08-28', group: 1},
  41. {id: 6, content: 'Edit Group Only', editable: { updateTime: false, updateGroup: true, remove: false }, start: '2010-08-29', group: 2},
  42. {id: 7, content: 'Remove Only', editable: { updateTime: false, updateGroup: false, remove: true }, start: '2010-08-31', end: '2010-09-03', group: 1},
  43. {id: 8, content: 'Default', start: '2010-09-04T12:00:00', group: 2}
  44. ]);
  45. var container = document.getElementById('visualization');
  46. var options = {
  47. editable: true // default for all items
  48. };
  49. var timeline = new vis.Timeline(container, items, groups, options);
  50. </script>
  51. </body>
  52. </html>