Browse Source

Removed option clear

flowchartTest
jos 9 years ago
parent
commit
7012eeb3e1
3 changed files with 3 additions and 45 deletions
  1. +0
    -12
      docs/timeline.html
  2. +2
    -32
      lib/timeline/Core.js
  3. +1
    -1
      lib/timeline/component/Legend.js

+ 0
- 12
docs/timeline.html View File

@ -872,18 +872,6 @@ var options = {
Returns ID of the newly created bar.
</td>
</tr>
<tr>
<td>clear([what])</td>
<td>none</td>
<td>
Clear the Timeline. An object can be passed specifying which sections to clear: items, groups,
and/or options. By Default, items, groups and options are cleared, i.e. <code>what = {items: true, groups: true, options: true}</code>. Example usage:
<pre class="prettyprint lang-js">timeline.clear(); // clear items, groups, and options
timeline.clear({options: true}); // clear options only
</pre>
</td>
</tr>
<tr>
<td>destroy()</td>

+ 2
- 32
lib/timeline/Core.js View File

@ -288,7 +288,8 @@ Core.prototype.isActive = function () {
*/
Core.prototype.destroy = function () {
// unbind datasets
this.clear();
this.setItems(null);
this.setGroups(null);
// remove all event listeners
this.off();
@ -455,37 +456,6 @@ Core.prototype.getVisibleItems = function() {
return this.itemSet && this.itemSet.getVisibleItems() || [];
};
/**
* Clear the Core. By Default, items, groups and options are cleared.
* Example usage:
*
* timeline.clear(); // clear items, groups, and options
* timeline.clear({options: true}); // clear options only
*
* @param {Object} [what] Optionally specify what to clear. By default:
* {items: true, groups: true, options: true}
*/
Core.prototype.clear = function(what) {
// clear items
if (!what || what.items) {
this.setItems(null);
}
// clear groups
if (!what || what.groups) {
this.setGroups(null);
}
// clear options of timeline and of each of the components
if (!what || what.options) {
this.components.forEach(component => component.setOptions(component.defaultOptions));
this.setOptions(this.defaultOptions); // this will also do a redraw
}
};
/**
* Set Core window such that it fits all items
* @param {Object} [options] Available options:

+ 1
- 1
lib/timeline/component/Legend.js View File

@ -39,7 +39,7 @@ Legend.prototype = new Component();
Legend.prototype.clear = function() {
this.groups = {};
this.amountOfGroups = 0;
}
};
Legend.prototype.addGroup = function(label, graphOptions) {

Loading…
Cancel
Save