Browse Source

Graph3d listens for changes in the dataset now

css_transitions
jos 10 years ago
parent
commit
b698f68b89
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      src/graph3d/Graph3d.js

+ 14
- 2
src/graph3d/Graph3d.js View File

@ -475,7 +475,7 @@ Graph3d.prototype.getColumnRange = function(data,column) {
if (minMax.max < data[i][column]) { minMax.max = data[i][column]; } if (minMax.max < data[i][column]) { minMax.max = data[i][column]; }
} }
return minMax; return minMax;
}
};
/** /**
* Initialize the data from the data table. Calculate minimum and maximum values * Initialize the data from the data table. Calculate minimum and maximum values
@ -484,6 +484,12 @@ Graph3d.prototype.getColumnRange = function(data,column) {
* @param {Number} style Style Number * @param {Number} style Style Number
*/ */
Graph3d.prototype._dataInitialize = function (rawData, style) { Graph3d.prototype._dataInitialize = function (rawData, style) {
var me = this;
// unsubscribe from the dataTable
if (this.dataSet) {
this.dataSet.off('*', this._onChange);
}
if (rawData === undefined) if (rawData === undefined)
return; return;
@ -503,8 +509,15 @@ Graph3d.prototype._dataInitialize = function (rawData, style) {
if (data.length == 0) if (data.length == 0)
return; return;
this.dataSet = rawData;
this.dataTable = data; this.dataTable = data;
// subscribe to changes in the dataset
this._onChange = function () {
me.setData(me.dataSet);
};
this.dataSet.on('*', this._onChange);
// _determineColumnIndexes // _determineColumnIndexes
// getNumberOfRows (points) // getNumberOfRows (points)
// getNumberOfColumns (x,y,z,v,t,t1,t2...) // getNumberOfColumns (x,y,z,v,t,t1,t2...)
@ -524,7 +537,6 @@ Graph3d.prototype._dataInitialize = function (rawData, style) {
if (data[0].hasOwnProperty("filter")) { if (data[0].hasOwnProperty("filter")) {
if (this.dataFilter === undefined) { if (this.dataFilter === undefined) {
this.dataFilter = new Filter(rawData, this.colFilter, this); this.dataFilter = new Filter(rawData, this.colFilter, this);
var me = this;
this.dataFilter.setOnLoadCallback(function() {me.redraw();}); this.dataFilter.setOnLoadCallback(function() {me.redraw();});
} }
} }

Loading…
Cancel
Save