Customizing velocity

In our previous recipe, we touched upon force simulation node object and its {x, y} attributes, which determine the location of a node on the layout. In this recipe, we will discuss another interesting aspect of physical motion simulation: velocity. The D3 force layout has a built-in support for velocity simulation, which relies on the {vx, vy} attributes on the node object. Let's see how this can be done in the example described in this recipe.

Getting ready

Open your local copy of the following file in your web browser: .

How to do it...

In this recipe, we will modify the previous recipe by first disabling both positioning and charge and then ...

Get Data Visualization with D3 4.x Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.