O'Reilly logo

Practical Data Analysis by Hector Cuesta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementation in D3.js

In this chapter, we will create an animation in D3.js of a Brownian motion random walk simulation. In the simulation, we will control the delay of the animation, the starting point of the random walk, and the tendency of the up-down factor.

First, we need to create an HTML file named Simulation.html and we will run it from Python http.server. In order to run the animation, we just need to open a command terminal and run the following command:

>>python –m http.server 8000

Then, we just need to open a web browser and type http://localhost:8000 and select our HTML file, after that we can see the animation running.

Then, we need to import the D3 library either directly from the website or with a local copy of the d3.v3.min.js ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required