- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Timeline | Individual editable items</title>
-
- <style>
- body, html {
- font-family: arial, sans-serif;
- font-size: 11pt;
- }
-
- div.vis-editable,
- div.vis-editable.vis-selected {
- /* custom styling for editable items... */
- }
-
- div.vis-readonly,
- div.vis-readonly.vis-selected {
- /* custom styling for readonly items... */
- background-color: #ff4500;
- border-color: red;
- color: white;
- }
- </style>
-
- <script src="../../../dist/vis.js"></script>
- <link href="../../../dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
-
- </head>
- <body>
-
- <p>Specify individual items to be editable or readonly.</p>
-
- <div id="visualization"></div>
-
- <script>
- // create groups to highlight groupUpdate
- var groups = new vis.DataSet([
- {id: 1, content: 'Group 1'},
- {id: 2, content: 'Group 2'}
- ]);
- // create a DataSet with items
- var items = new vis.DataSet([
- {id: 1, content: 'Editable', editable: true, start: '2010-08-23', group: 1},
- {id: 2, content: 'Editable', editable: true, start: '2010-08-23T23:00:00', group: 2},
- {id: 3, content: 'Read-only', editable: false, start: '2010-08-24T16:00:00', group: 1},
- {id: 4, content: 'Read-only', editable: false, start: '2010-08-26', end: '2010-09-02', group: 2},
- {id: 5, content: 'Edit Time Only', editable: { updateTime: true, updateGroup: false, remove: false }, start: '2010-08-28', group: 1},
- {id: 6, content: 'Edit Group Only', editable: { updateTime: false, updateGroup: true, remove: false }, start: '2010-08-29', group: 2},
- {id: 7, content: 'Remove Only', editable: { updateTime: false, updateGroup: false, remove: true }, start: '2010-08-31', end: '2010-09-03', group: 1},
- {id: 8, content: 'Default', start: '2010-09-04T12:00:00', group: 2}
- ]);
-
- var container = document.getElementById('visualization');
- var options = {
- editable: true // default for all items
- };
-
- var timeline = new vis.Timeline(container, items, groups, options);
-
- </script>
- </body>
- </html>
|