Browse Source

Fixed #665, fixed #149: Implemented orientation option `'both'`, displaying a time axis both on top and bottom.

v3_develop
jos 9 years ago
parent
commit
f29176bcac
9 changed files with 63 additions and 12 deletions
  1. +2
    -0
      HISTORY.md
  2. +26
    -2
      dist/vis.js
  3. +1
    -1
      dist/vis.map
  4. +6
    -6
      dist/vis.min.js
  5. +1
    -1
      docs/graph2d.html
  6. +1
    -1
      docs/timeline.html
  7. +23
    -0
      lib/timeline/Core.js
  8. +2
    -1
      lib/timeline/Timeline.js
  9. +1
    -0
      test/timeline.html

+ 2
- 0
HISTORY.md View File

@ -18,6 +18,8 @@ http://visjs.org
### Timeline ### Timeline
- Implemented orientation option `'both'`, displaying a time axis both on top
and bottom (#665).
- Fixed not property initializing with a DataView for groups. - Fixed not property initializing with a DataView for groups.
- Merged add custom timebar functionality, thanks @aytech! - Merged add custom timebar functionality, thanks @aytech!
- Fixed #664: end of item not restored when canceling a move event. - Fixed #664: end of item not restored when canceling a move event.

+ 26
- 2
dist/vis.js View File

@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 3.10.1-SNAPSHOT * @version 3.10.1-SNAPSHOT
* @date 2015-03-02
* @date 2015-03-03
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -6504,7 +6504,7 @@ return /******/ (function(modules) { // webpackBootstrap
autoResize: true, autoResize: true,
orientation: 'bottom',
orientation: 'bottom', // 'bottom', 'top', or 'both'
width: null, width: null,
height: null, height: null,
maxHeight: null, maxHeight: null,
@ -6549,6 +6549,7 @@ return /******/ (function(modules) { // webpackBootstrap
// time axis // time axis
this.timeAxis = new TimeAxis(this.body); this.timeAxis = new TimeAxis(this.body);
this.timeAxis2 = null; // used in case of orientation option 'both'
this.components.push(this.timeAxis); this.components.push(this.timeAxis);
// current time bar // current time bar
@ -22503,6 +22504,7 @@ return /******/ (function(modules) { // webpackBootstrap
var DataView = __webpack_require__(4); var DataView = __webpack_require__(4);
var Range = __webpack_require__(17); var Range = __webpack_require__(17);
var ItemSet = __webpack_require__(32); var ItemSet = __webpack_require__(32);
var TimeAxis = __webpack_require__(35);
var Activator = __webpack_require__(53); var Activator = __webpack_require__(53);
var DateUtil = __webpack_require__(15); var DateUtil = __webpack_require__(15);
var CustomTime = __webpack_require__(27); var CustomTime = __webpack_require__(27);
@ -22690,6 +22692,28 @@ return /******/ (function(modules) { // webpackBootstrap
var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation', 'clickToUse', 'dataAttributes', 'hiddenDates']; var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation', 'clickToUse', 'dataAttributes', 'hiddenDates'];
util.selectiveExtend(fields, this.options, options); util.selectiveExtend(fields, this.options, options);
if (this.options.orientation === 'both') {
if (!this.timeAxis2) {
var timeAxis2 = this.timeAxis2 = new TimeAxis(this.body);
timeAxis2.setOptions = function (options) {
var _options = options ? util.extend({}, options) : {};
_options.orientation = 'top'; // override the orientation option, always top
TimeAxis.prototype.setOptions.call(timeAxis2, _options);
};
this.components.push(timeAxis2);
}
}
else {
if (this.timeAxis2) {
var index = this.components.indexOf(this.timeAxis2);
if (index !== -1) {
this.components.splice(index, 1);
}
this.timeAxis2.destroy();
this.timeAxis2 = null;
}
}
if ('hiddenDates' in this.options) { if ('hiddenDates' in this.options) {
DateUtil.convertHiddenOptions(this.body, this.options.hiddenDates); DateUtil.convertHiddenOptions(this.body, this.options.hiddenDates);
} }

+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


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


+ 1
- 1
docs/graph2d.html View File

@ -678,7 +678,7 @@ The options colored in green can also be used as options for the groups. All opt
<td>orientation</td> <td>orientation</td>
<td>String</td> <td>String</td>
<td>'bottom'</td> <td>'bottom'</td>
<td>Orientation of the timeline: 'top' or 'bottom' (default). If orientation is 'bottom', the time axis is drawn at the bottom, and if 'top', the axis is drawn on top.</td>
<td>Orientation of the timeline: 'top', 'bottom' (default), or 'both'. 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.</td>
</tr> </tr>
<tr> <tr>

+ 1
- 1
docs/timeline.html View File

@ -681,7 +681,7 @@ var options = {
<td>orientation</td> <td>orientation</td>
<td>String</td> <td>String</td>
<td>'bottom'</td> <td>'bottom'</td>
<td>Orientation of the timeline: 'top' or 'bottom' (default). If orientation is 'bottom', the time axis is drawn at the bottom, and if 'top', the axis is drawn on top.</td>
<td>Orientation of the timeline: 'top', 'bottom' (default), or 'both'. 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.</td>
</tr> </tr>
<tr> <tr>

+ 23
- 0
lib/timeline/Core.js View File

@ -5,6 +5,7 @@ var DataSet = require('../DataSet');
var DataView = require('../DataView'); var DataView = require('../DataView');
var Range = require('./Range'); var Range = require('./Range');
var ItemSet = require('./component/ItemSet'); var ItemSet = require('./component/ItemSet');
var TimeAxis = require('./component/TimeAxis');
var Activator = require('../shared/Activator'); var Activator = require('../shared/Activator');
var DateUtil = require('./DateUtil'); var DateUtil = require('./DateUtil');
var CustomTime = require('./component/CustomTime'); var CustomTime = require('./component/CustomTime');
@ -192,6 +193,28 @@ Core.prototype.setOptions = function (options) {
var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation', 'clickToUse', 'dataAttributes', 'hiddenDates']; var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation', 'clickToUse', 'dataAttributes', 'hiddenDates'];
util.selectiveExtend(fields, this.options, options); util.selectiveExtend(fields, this.options, options);
if (this.options.orientation === 'both') {
if (!this.timeAxis2) {
var timeAxis2 = this.timeAxis2 = new TimeAxis(this.body);
timeAxis2.setOptions = function (options) {
var _options = options ? util.extend({}, options) : {};
_options.orientation = 'top'; // override the orientation option, always top
TimeAxis.prototype.setOptions.call(timeAxis2, _options);
};
this.components.push(timeAxis2);
}
}
else {
if (this.timeAxis2) {
var index = this.components.indexOf(this.timeAxis2);
if (index !== -1) {
this.components.splice(index, 1);
}
this.timeAxis2.destroy();
this.timeAxis2 = null;
}
}
if ('hiddenDates' in this.options) { if ('hiddenDates' in this.options) {
DateUtil.convertHiddenOptions(this.body, this.options.hiddenDates); DateUtil.convertHiddenOptions(this.body, this.options.hiddenDates);
} }

+ 2
- 1
lib/timeline/Timeline.js View File

@ -38,7 +38,7 @@ function Timeline (container, items, groups, options) {
autoResize: true, autoResize: true,
orientation: 'bottom',
orientation: 'bottom', // 'bottom', 'top', or 'both'
width: null, width: null,
height: null, height: null,
maxHeight: null, maxHeight: null,
@ -83,6 +83,7 @@ function Timeline (container, items, groups, options) {
// time axis // time axis
this.timeAxis = new TimeAxis(this.body); this.timeAxis = new TimeAxis(this.body);
this.timeAxis2 = null; // used in case of orientation option 'both'
this.components.push(this.timeAxis); this.components.push(this.timeAxis);
// current time bar // current time bar

+ 1
- 0
test/timeline.html View File

@ -102,6 +102,7 @@
var options = { var options = {
editable: true, editable: true,
//orientation: 'top', //orientation: 'top',
orientation: 'both',
start: now.clone().add(-7, 'days'), start: now.clone().add(-7, 'days'),
end: now.clone().add(7, 'days'), end: now.clone().add(7, 'days'),
//maxHeight: 200, //maxHeight: 200,

Loading…
Cancel
Save