specifying initial columns in the cartoons

This commit is contained in:
Stuart Lynn 2015-11-06 17:06:45 +00:00
parent dea2f1f27f
commit aafbf83d6c
2 changed files with 8 additions and 3 deletions

View File

@ -29,8 +29,8 @@
//color scale from http://colorbrewer2.org/ //color scale from http://colorbrewer2.org/
var CARTOCSS = [ var CARTOCSS = [
'Map {', 'Map {',
'-torque-time-attribute: "tpep_dropoff_datetime";', '-torque-time-attribute: "transaction_date";',
'-torque-aggregation-function: "avg(temp::float)";', '-torque-aggregation-function: "count(1);avg(confidence_score);merchant_name";',
'-torque-frame-count: 1;', '-torque-frame-count: 1;',
'-torque-animation-duration: 15;', '-torque-animation-duration: 15;',
'-torque-resolution: 1', '-torque-resolution: 1',
@ -63,7 +63,7 @@
var torqueLayer = new L.TorqueLayer({ var torqueLayer = new L.TorqueLayer({
user : 'stuartlynn', user : 'stuartlynn',
table : 'sampled_taxi_data', table : 'yodlee_512',
cartocss: CARTOCSS, cartocss: CARTOCSS,
provider: "filterable_sql_api" provider: "filterable_sql_api"
}); });

View File

@ -30,10 +30,15 @@ L.TorqueLayer = L.CanvasLayer.extend({
this.key = 0; this.key = 0;
this.prevRenderedKey = 0; this.prevRenderedKey = 0;
this._filters = {} this._filters = {}
if (options.cartocss) { if (options.cartocss) {
torque.extend(options, torque.common.TorqueLayer.optionsFromCartoCSS(options.cartocss)); torque.extend(options, torque.common.TorqueLayer.optionsFromCartoCSS(options.cartocss));
} }
options.columns = options.countby.split(";")
options.resolution = options.resolution || 2; options.resolution = options.resolution || 2;
options.steps = options.steps || 100; options.steps = options.steps || 100;
options.visible = options.visible === undefined ? true: options.visible; options.visible = options.visible === undefined ? true: options.visible;