Browse Source

fixed creation and deletion of empty groups when there are not yet items

v3_develop
Alex de Mulder 10 years ago
parent
commit
72cbed1eac
4 changed files with 25240 additions and 25483 deletions
  1. +25224
    -25465
      dist/vis.js
  2. +1
    -1
      dist/vis.min.css
  3. +0
    -1
      examples/graph2d/15_streaming_data.html
  4. +15
    -16
      lib/timeline/component/LineGraph.js

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


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


+ 0
- 1
examples/graph2d/15_streaming_data.html View File

@ -40,7 +40,6 @@
// create a graph2d with an (currently empty) dataset // create a graph2d with an (currently empty) dataset
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');
var dataset = new vis.DataSet(); var dataset = new vis.DataSet();
var now = vis.moment();
var options = { var options = {
start: vis.moment().add(-30, 'seconds'), // changed so its faster start: vis.moment().add(-30, 'seconds'), // changed so its faster

+ 15
- 16
lib/timeline/component/LineGraph.js View File

@ -441,26 +441,21 @@ LineGraph.prototype._updateAllGroupData = function () {
* @protected * @protected
*/ */
LineGraph.prototype._updateUngrouped = function() { LineGraph.prototype._updateUngrouped = function() {
if (this.itemsData != null) {
// var t0 = new Date();
var group = {id: UNGROUPED, content: this.options.defaultGroup};
this._updateGroup(group, UNGROUPED);
if (this.itemsData && this.itemsData != null) {
var ungroupedCounter = 0; var ungroupedCounter = 0;
if (this.itemsData) {
for (var itemId in this.itemsData._data) {
if (this.itemsData._data.hasOwnProperty(itemId)) {
var item = this.itemsData._data[itemId];
if (item != undefined) {
if (item.hasOwnProperty('group')) {
if (item.group === undefined) {
item.group = UNGROUPED;
}
}
else {
for (var itemId in this.itemsData._data) {
if (this.itemsData._data.hasOwnProperty(itemId)) {
var item = this.itemsData._data[itemId];
if (item != undefined) {
if (item.hasOwnProperty('group')) {
if (item.group === undefined) {
item.group = UNGROUPED; item.group = UNGROUPED;
} }
ungroupedCounter = item.group == UNGROUPED ? ungroupedCounter + 1 : ungroupedCounter;
} }
else {
item.group = UNGROUPED;
}
ungroupedCounter = item.group == UNGROUPED ? ungroupedCounter + 1 : ungroupedCounter;
} }
} }
} }
@ -472,6 +467,10 @@ LineGraph.prototype._updateUngrouped = function() {
this.yAxisLeft.removeGroup(UNGROUPED); this.yAxisLeft.removeGroup(UNGROUPED);
this.yAxisRight.removeGroup(UNGROUPED); this.yAxisRight.removeGroup(UNGROUPED);
} }
else {
var group = {id: UNGROUPED, content: this.options.defaultGroup};
this._updateGroup(group, UNGROUPED);
}
} }
else { else {
delete this.groups[UNGROUPED]; delete this.groups[UNGROUPED];

Loading…
Cancel
Save