Search code examples
javascriptd3.jscubism.js

What does serverDelay in cubism.js do?


In the introductory example at http://bost.ocks.org/mike/cubism/intro/demo-stocks.html, the line to create the context is:

var context = cubism.context()
                    .serverDelay(new Date(2012, 4, 2) - Date.now())
                    .step(864e5)
                    .size(1280)
                    .stop();

I understood the line except for the serverDelay() part, however after playing with the values inside, it seems to be changing the scale.

At the official documentation at https://github.com/square/cubism/wiki/Context#wiki-serverDelay, serverDelay is defined as follows:

The server delay is the amount of time the context waits for the server to compute or collect metrics.

However, this definition is not very helpful in understanding how it changes the scales.

I've also searched similar stackoverflow threads and this link axis scale in cubism context in d3.js is the closest that I could find.

Could someone please help me demystify this function call?

All help is greatly appreciated. Thanks.


Solution

  • I found the answer myself. Cubism auto-advances one tick at a time, but this method allows you to advance many ticks at once.