Browse Source

fixed uneven spacing of hidden dates

v3_develop
Alex de Mulder 9 years ago
parent
commit
ec8b53d938
6 changed files with 25930 additions and 25995 deletions
  1. +6
    -0
      HISTORY.md
  2. +25909
    -25945
      dist/vis.js
  3. +2
    -2
      examples/timeline/29_hiding_times.html
  4. +12
    -47
      lib/timeline/DateUtil.js
  5. +0
    -1
      lib/timeline/TimeStep.js
  6. +1
    -0
      lib/timeline/component/TimeAxis.js

+ 6
- 0
HISTORY.md View File

@ -1,6 +1,12 @@
# vis.js history
http://visjs.org
## 2014-10-21, version 3.6.1
### Timeline
- Fixed uneven stepsized with hidden dates
## 2014-10-21, version 3.6.0
### Network

+ 25909
- 25945
dist/vis.js
File diff suppressed because it is too large
View File


+ 2
- 2
examples/timeline/29_hiding_times.html View File

@ -32,8 +32,8 @@
var options = {
hiddenDates: [
{start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00'},
{start: '2013-03-29 00:00:00', end: '2013-03-31 00:00:00', repeat: 'weekly'}, // daily weekly monthly yearly
{start: '2013-03-29 20:00:00', end: '2013-03-31 9:00:00', repeat: 'daily'} // daily weekly monthly yearly
{start: '2014-03-29 00:00:00', end: '2014-03-31 00:00:00', repeat: 'weekly'}, // daily weekly monthly yearly
{start: '2013-03-29 20:00:00', end: '2013-03-30 9:00:00', repeat: 'daily'} // daily weekly monthly yearly
],
start: '2014-04-17',
end: '2014-05-01',

+ 12
- 47
lib/timeline/DateUtil.js View File

@ -10,42 +10,6 @@ var moment = require('../module/moment');
* @param Core
*/
exports.convertHiddenOptions = function(body, hiddenDates) {
//var specificHiddenDates = hiddenDates.specific;
//if (specificHiddenDates) {
// if (Array.isArray(specificHiddenDates) == true) {
// for (var i = 0; i < specificHiddenDates.length; i++) {
// var dateItem = {};
// 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) {
// return a.start - b.start;
// }); // sort by start time
// }
// else {
// body.hiddenDates = [{
// start: moment(specificHiddenDates.start).toDate().valueOf(),
// end: moment(specificHiddenDates.end).toDate().valueOf()
// }
// ];
// }
//}
//
//// allowing multiple input formats
//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];
// }
// }
//}
body.hiddenDates = [];
if (hiddenDates) {
if (Array.isArray(hiddenDates) == true) {
@ -94,25 +58,25 @@ exports.updateHiddenDates = function (body, hiddenDates) {
if (startDate.day() != endDate.day()) {
offset = 1;
}
startDate.day(start.day);
startDate.subtract(7,'days');
startDate.month(start.month());
startDate.dayOfYear(start.dayOfYear());
startDate.year(start.year());
startDate.subtract(7,'days');
endDate.day(start.day);
endDate.subtract(7 + offset,'days');
endDate.month(start.month());
endDate.dayOfYear(start.dayOfYear());
endDate.year(start.year());
endDate.subtract(7,'days');
endDate.add(offset,'days');
break;
case "weekly":
if (startDate.week() != endDate.week()) {
offset = 1;
}
startDate.week(start.week() - 1)
startDate.week(start.week() - 1);
startDate.year(start.year());
endDate.week(start.week() - 1 + offset)
endDate.week(start.week() - 1);
endDate.year(start.year());
endDate.add(offset,'weeks');
break
case "monthly":
if (startDate.month() != endDate.month()) {
@ -121,16 +85,17 @@ exports.updateHiddenDates = function (body, hiddenDates) {
startDate.month(start.month() - 1)
startDate.year(start.year());
endDate.month(start.month() - 1 + offset)
endDate.month(start.month() - 1);
endDate.year(start.year());
endDate.add(offset,'months');
break;
case "yearly":
if (startDate.year() != endDate.year()) {
offset = 1;
}
startDate.year(start.year() - 1);
endDate.year(start.year() - 1 + offset);
endDate.year(start.year() - 1);
endDate.add(offset,'years');
break;
default:
console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat);

+ 0
- 1
lib/timeline/TimeStep.js View File

@ -451,7 +451,6 @@ TimeStep.prototype.isMajor = function() {
}
}
switch (this.scale) {
case TimeStep.SCALE.MILLISECOND:
return (this.current.getMilliseconds() == 0);

+ 1
- 0
lib/timeline/component/TimeAxis.js View File

@ -207,6 +207,7 @@ TimeAxis.prototype._repaintLabels = function () {
var x = this.body.util.toScreen(cur);
var isMajor = step.isMajor();
// TODO: lines must have a width, such that we can create css backgrounds
if (this.options.showMinorLabels) {

Loading…
Cancel
Save