I have a date column that ranges from 1998 to 2013, but each year the specific dates are always from the same three months (March, April and May). I would want to show only these months (where there is data) instead of every month of every year, because most of the time there is nothing to show. Is there any way to do this in CartoDB?

1 Answer 1


Torque does not allow to have time intervals, it uses the whole range. My solution here would require javascript coding:

*Load the visualization using the javascript library (cartodb.js)

*get the reference to the torque layer:

createVis(map, '....').done(function(vis, layers) {
 var torqueLayer = layers[1]; // the index depends on your visualization

*stop the visualization


*animate it by yourself changing the animation frame depending on the month, this example is for 6 years (1998-2013), with torque-steps = 6*12*4 (one week resolution)

var Y1999 = 12*4
var monthsFrames = [ 
  3*4 + 0, 3*4 + 1, 3*4 + 2, 3*4 + 3,.... 5*4 + 3, // from 1st march week to last may week
  Y1999 +  3*4 + 0,  Y1999 + 3*4 + 1,.... 
var frame = 0;
setInterval(function() {
  frame = frame % monthsFrames.length

}, FRAME_TIME) // with frame_time you control the animation time

(the code is not tested)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.