Search code examples
cesiumjs

Set time for one tick mark in cesium


Is there a way to set how much time one tick mark on the time line in Cesium is equal to? I know viewer.timeline.zoomTo() sets the time range for the whole timeline.


Solution

  • There's no public API for this, but if you're OK with a little hacking, you can find this answer in local variable tinyTic in Timeline.js around line 490. The line I've identified here is just a blank line between two sections of code: the code above this line is the last bit of logic to modify tinyTic (possibly resetting it to minSize on line 485), and then on line 493 you can see tic = getNextTic(tic, tinyTic) being used to generate the smallest tics.

    You could, for example, add a line of code on L490 that saves the value of tinyTic to some object that you can access from outside code. The value here is measured in seconds (so 5 means 5 seconds, 300 means 5 minutes, etc).