0

I have a Torque map like this one and at the same time the bubbles are showing up I would like to render a growing graph with the number of bubbles accumulated. I don't expect CartoDB to do this for me but if CartoDB is able to send events to my JS functions I can do it.

So, the question is, is it CartoDB able to send events to JS functions when a new market is rendered?

2 Answers 2

2

You don't need a javascript query, you only need to know the number of bubbles per time and then get the change:time signal in torque layer.

layer.on('change:time', function(datetime) {
 // update graph
})

For number of bubbles you can get them from SQL API with a simple query or use this small hack I did some time ago https://gist.github.com/javisantana/622437e65cae00a7cb20

0

indeed Torque can send events to JS functions. maybe it's not exactly what you need (the number of bubbles accumulated) but you can set a listener on time change.

Thus you can access the time and step values. Find attached an example: http://bl.ocks.org/matallo/db7bcda00e6168a061eb

For the number of bubbles you can get them with the example query by @javisantana earlier.

Cheers

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.