cumulative working
This commit is contained in:
parent
f3e45f523e
commit
f5ce6e7839
@ -28,6 +28,10 @@
|
||||
this.options.tiler_domain = options.tiler_domain || 'cartodb.com';
|
||||
this.options.tiler_port = options.tiler_port || 80;
|
||||
|
||||
if (this.options.data_aggregation) {
|
||||
this.options.cumulative = this.options.data_aggregation === 'cumulative';
|
||||
}
|
||||
|
||||
// check options
|
||||
if (options.resolution === undefined ) throw new Error("resolution should be provided");
|
||||
if (options.steps === undefined ) throw new Error("steps should be provided");
|
||||
@ -70,7 +74,7 @@
|
||||
}
|
||||
|
||||
if(this.options.cumulative) {
|
||||
dates = maxDateSlots * rows.length;
|
||||
dates = (1 + maxDateSlots) * rows.length;
|
||||
}
|
||||
|
||||
// reserve memory for all the dates
|
||||
@ -117,7 +121,7 @@
|
||||
// extend the latest to the end
|
||||
if(this.options.cumulative) {
|
||||
var lastDateSlot = dates[dates.length - 1];
|
||||
for (var j = lastDateSlot; j < maxDateSlots; ++j) {
|
||||
for (var j = lastDateSlot; j <= maxDateSlots; ++j) {
|
||||
var rr = rowsPerSlot[j] || (rowsPerSlot[j] = []);
|
||||
rr.push([r, prev_val]);
|
||||
}
|
||||
@ -361,6 +365,14 @@
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if(opt.data_aggregation !== undefined) {
|
||||
var c = opt.data_aggregation === 'cumulative';
|
||||
if (this.options.cumulative !== c) {
|
||||
this.options.cumulative = c;
|
||||
refresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (refresh) this.reload();
|
||||
return refresh;
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
this._ctx = canvas.getContext('2d');
|
||||
this._sprites = []; // sprites per layer
|
||||
this._shader = null;
|
||||
//carto.tree.Reference.set(torque['torque-reference']);
|
||||
this.setCartoCSS(this.options.cartocss || DEFAULT_CARTOCSS);
|
||||
}
|
||||
|
||||
@ -113,13 +112,13 @@
|
||||
|
||||
var prof = Profiler.metric('PointRenderer:renderTile').start();
|
||||
var ctx = this._ctx;
|
||||
|
||||
if(this.options.blendmode) {
|
||||
ctx.globalCompositeOperation = this.options.blendmode;
|
||||
var blendMode = shader.eval('comp-op') || this.options.blendmode;
|
||||
if(blendMode) {
|
||||
ctx.globalCompositeOperation = blendMode;
|
||||
}
|
||||
if (this.options.cumulative && key > tile.maxDate) {
|
||||
//TODO: precache because this tile is not going to change
|
||||
key = tile.maxDate - 1;
|
||||
key = tile.maxDate;
|
||||
}
|
||||
var tileMax = this.options.resolution * (256/this.options.resolution - 1)
|
||||
var activePixels = tile.timeCount[key];
|
||||
|
Loading…
Reference in New Issue
Block a user