Skip to main content
100%

Timeline with Procedurally Generated Data

✓ Published0🌍 Public
DDinoJay
Last edited May 29, 2017
Created on May 29, 2017

This animated example shows a timeline visualization that procedurally generates random bands of data, with each band’s start and end values falling between 1 and 40. Every 500 milliseconds, a new band is added, and the timeline updates over a 400-millisecond transition, ultimately generating 100 bands. Earlier bands are rendered with greater transparency than later ones, creating a sense of depth. The d3.layout.timeline library’s `extent` and `maxBandHeight` settings keep the axes fixed so the chart does not resize as data is appended.

AI-generated description

An example of d3.layout.timeline that generates random bands of data (with s and e somewhere between 1 & 40) and updates the timeline with the new band of data. A new band is generated every 500ms until 100 bands are generated.

Bands placed earlier are made more transparent than bands placed later.

This uses the layout's extent function to set the extent to a fixed [1,40] so that it does not dramatically resize in width as more elements are added. It also uses the maxBandHeight set to 20 to keep the timeline from dramatically resizing in height. Notice that there is no corresponding minBandHeight since there is no way to know how many lanes will be necessary to represent the data. padding is also used to give a small gap between lanes.

forked from <a href='http://bl.ocks.org/emeeks/'>emeeks</a>'s block: <a href='http://bl.ocks.org/emeeks/221c931a1cd8c040d8e7'>d3.layout.timeline with procedurally generated data</a>

mit Licensed

Similar vizzes