Skip to content

Commit

Permalink
fix maxItems
Browse files Browse the repository at this point in the history
  • Loading branch information
filipporampado committed Jun 29, 2015
1 parent 769fdb2 commit 0202d1d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion lib/dataTier/flow/mapChartFlowModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ MapChartFlowModel.prototype.updateProperties = function(params){

MapChartFlowModel.prototype.addRecord = function(record){
if(record!==undefined && record!==null && typeof record === 'object'){
if (this._records.length===this._maxItemsSaved){
if (this._records.length>=this._maxItemsSaved){
//delete first element
this._records.splice(0, 1);
}
Expand Down Expand Up @@ -144,6 +144,10 @@ MapChartFlowModel.prototype.updateMovie = function(par){
var recordsID=[];
var i=0;
for (var keyParam in params) {
if (this._records.length>=this._maxItemsSaved){
//too many records
break;
}
if(params[keyParam][this._latitudeKey] === undefined ||
params[keyParam][this._longitudeKey] === undefined ||
params[keyParam][this._objectKey] === undefined){
Expand Down
2 changes: 1 addition & 1 deletion lib/dataTier/flow/tableFlowModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ TableFlowModel.prototype.addRecord = function(rec){
record.appearance=undefined;
}
}
if (this._records.length===this._maxItemsSaved){
if (this._records.length>=this._maxItemsSaved){
//delete first element
this._records.splice(0, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion systemTest/TS3.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var TS=function(page){
flowColor: '#B9D3EE',
marker: 'triangle',
xFormat: 'toFloat',
maxItems: 50,
maxItemsSaved: 50,
filters: 'temperatura>2'
});
lineChartFlow.addRecord({'tempo': 1, 'temperatura': 15});
Expand Down
2 changes: 1 addition & 1 deletion systemTest/TS4.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var TS=function(page){
latitudeFormat: 'toFloat',
objectKey: '0',
filters:'IdMezzo>806',
maxItems: 50
maxItemsSaved: 50
});
mapChartFlow.updateMovie(
[{'0':875,'IdMezzo':875,'1':45.42533493042,'WGS84Fi':45.42533493042,'2':11.902134895325,'WGS84La':11.902134895325,'3':14,'Girometro':14,'4':0,'StatoPorte':0,'capolinea':'Capolinea Torre'},
Expand Down
4 changes: 2 additions & 2 deletions systemTest/TS7.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var TS=function(lineChart){
name: 'grafico tempo-temperatura',
xKey: 'tempo',
yKey: 'temperatura',
maxItems: 5,
maxItemsSaved: 5,
//filters: 'temperatura>3'
});
var IDs=[];
Expand All @@ -42,7 +42,7 @@ var TS=function(lineChart){
name: 'grafico tempo-temperatura',
xKey: 'tempo',
yKey: 'temperatura',
maxItems: 4,
maxItemsSaved: 4,
//filters: 'temperatura>3'
});
lineChart.addRecord('flow2',{'tempo': 1, 'temperatura': 15});
Expand Down
6 changes: 3 additions & 3 deletions systemTest/TS8.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var TS=function(mapChart){
longitudeKey: '2',
objectKey: '0',
//filters:'IdMezzo>806',
maxItems: 5
maxItemsSaved: 5
});
mapChart.createMapChartFlow({
ID:'flow2',
Expand All @@ -47,7 +47,7 @@ var TS=function(mapChart){
longitudeKey: '2',
objectKey: '0',
//filters:'IdMezzo>806',
maxItems: 5
maxItemsSaved: 5
});
mapChart.createMapChartFlow({
ID:'flow3',
Expand All @@ -60,7 +60,7 @@ var TS=function(mapChart){
longitudeKey: '2',
objectKey: '0',
//filters:'IdMezzo>806',
maxItems: 5
maxItemsSaved: 5
});
var IDs=mapChartFlow1.updateMovie([
{'0':875,'1':45.42533493042,'2':11.902134895325},
Expand Down

0 comments on commit 0202d1d

Please sign in to comment.