Browse Source

Docs and history for hiddenDates

v3_develop
Alex de Mulder 10 years ago
parent
commit
5eac1cf625
5 changed files with 85 additions and 17 deletions
  1. +2
    -1
      HISTORY.md
  2. +22
    -8
      dist/vis.js
  3. +39
    -0
      docs/timeline.html
  4. +0
    -0
      examples/timeline/29_hiding_times.html
  5. +22
    -8
      lib/timeline/DateUtil.js

+ 2
- 1
HISTORY.md View File

@ -21,7 +21,8 @@ http://visjs.org
individual items.
- Fixed height of BackgroundItems not being 100% when timeline has a fixed height.
- Fixed width of BackgroundItems not being reduced to 0 when zooming out.
- Fixed onclick events in items not working.
- Fixed onclick events in items not working.
- Added hiddenDates to hide specific times and/or days in the timeline.
### DataSet

+ 22
- 8
dist/vis.js View File

@ -12575,13 +12575,13 @@ return /******/ (function(modules) { // webpackBootstrap
* @param Core
*/
exports.convertHiddenOptions = function(body, hiddenDates) {
var hiddenTimes = hiddenDates.specific;
if (hiddenTimes) {
if (Array.isArray(hiddenTimes) == true) {
for (var i = 0; i < hiddenTimes.length; i++) {
var specificHiddenDates = hiddenDates.specific;
if (specificHiddenDates) {
if (Array.isArray(specificHiddenDates) == true) {
for (var i = 0; i < specificHiddenDates.length; i++) {
var dateItem = {};
dateItem.start = moment(hiddenTimes[i].start).toDate().valueOf();
dateItem.end = moment(hiddenTimes[i].end).toDate().valueOf();
dateItem.start = moment(specificHiddenDates[i].start).toDate().valueOf();
dateItem.end = moment(specificHiddenDates[i].end).toDate().valueOf();
body.hiddenDates.push(dateItem);
}
body.hiddenDates.sort(function (a, b) {
@ -12590,12 +12590,26 @@ return /******/ (function(modules) { // webpackBootstrap
}
else {
body.hiddenDates = [{
start: moment(hiddenTimes.start).toDate().valueOf(),
end: moment(hiddenTimes.end).toDate().valueOf()
start: moment(specificHiddenDates.start).toDate().valueOf(),
end: moment(specificHiddenDates.end).toDate().valueOf()
}
];
}
}
var periodicHiddenDates = hiddenDates.periodic;
if (periodicHiddenDates) {
if (periodicHiddenDates.times) {
if (Array.isArray(periodicHiddenDates.times) != true) {
periodicHiddenDates.times = [periodicHiddenDates.times];
}
}
if (periodicHiddenDates.days) {
if (Array.isArray(periodicHiddenDates.days) != true) {
periodicHiddenDates.days = [periodicHiddenDates.days];
}
}
}
};
exports.updateHiddenDates = function (body, hiddenDates) {

+ 39
- 0
docs/timeline.html View File

@ -479,6 +479,45 @@ var options = {
</td>
</tr>
<tr>
<td>hiddenDates</td>
<td>Object</td>
<td>none</td>
<td>This option allows you to hide specific timespans from the time axis. For usage, look at the object definitions below.
</td>
</tr>
<tr>
<td>hiddenDates.specific</td>
<td>Array | Object</td>
<td>none</td>
<td>The specific hiddenDates are manually, fully defined dates that will be hidden from the timeline. The dates can be supplied as an object:
<code>{start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00'}</code> or as an Array of these objects.
</td>
</tr>
<tr>
<td>hiddenDates.periodic</td>
<td>Object</td>
<td>none</td>
<td>This option can be used to specify recurring days and times that have to be hidden from view (weekends, working hours etc.).
</td>
</tr>
<tr>
<td>hiddenDates.periodic.times</td>
<td>Array | Object</td>
<td>none</td>
<td>You can manually specify times which will then be hidden every day on the timeline. These are defined as an object: <code>{start:'20:00:00', end:'09:00:00'}</code>
or as an Array of these objects.
</td>
</tr>
<tr>
<td>hiddenDates.periodic.days</td>
<td>Array | Object</td>
<td>none</td>
<td>You can manually specify days which will then be hidden every week on the timeline. These are defined as an object: <code>{start:6, end:1}</code>
or as an Array of these objects. 1 stands for Monday and 7 stands for Sunday. So: <code>{start:6, end:1}</code> means hide Saturday and Sunday.
</td>
</tr>
<tr>
<td>locale</td>
<td>String</td>

examples/timeline/hiding_times.html → examples/timeline/29_hiding_times.html View File


+ 22
- 8
lib/timeline/DateUtil.js View File

@ -10,13 +10,13 @@ var moment = require('../module/moment');
* @param Core
*/
exports.convertHiddenOptions = function(body, hiddenDates) {
var hiddenTimes = hiddenDates.specific;
if (hiddenTimes) {
if (Array.isArray(hiddenTimes) == true) {
for (var i = 0; i < hiddenTimes.length; i++) {
var specificHiddenDates = hiddenDates.specific;
if (specificHiddenDates) {
if (Array.isArray(specificHiddenDates) == true) {
for (var i = 0; i < specificHiddenDates.length; i++) {
var dateItem = {};
dateItem.start = moment(hiddenTimes[i].start).toDate().valueOf();
dateItem.end = moment(hiddenTimes[i].end).toDate().valueOf();
dateItem.start = moment(specificHiddenDates[i].start).toDate().valueOf();
dateItem.end = moment(specificHiddenDates[i].end).toDate().valueOf();
body.hiddenDates.push(dateItem);
}
body.hiddenDates.sort(function (a, b) {
@ -25,12 +25,26 @@ exports.convertHiddenOptions = function(body, hiddenDates) {
}
else {
body.hiddenDates = [{
start: moment(hiddenTimes.start).toDate().valueOf(),
end: moment(hiddenTimes.end).toDate().valueOf()
start: moment(specificHiddenDates.start).toDate().valueOf(),
end: moment(specificHiddenDates.end).toDate().valueOf()
}
];
}
}
var periodicHiddenDates = hiddenDates.periodic;
if (periodicHiddenDates) {
if (periodicHiddenDates.times) {
if (Array.isArray(periodicHiddenDates.times) != true) {
periodicHiddenDates.times = [periodicHiddenDates.times];
}
}
if (periodicHiddenDates.days) {
if (Array.isArray(periodicHiddenDates.days) != true) {
periodicHiddenDates.days = [periodicHiddenDates.days];
}
}
}
};
exports.updateHiddenDates = function (body, hiddenDates) {

Loading…
Cancel
Save