GithubHelp home page GithubHelp logo

kevlund / d3-for-the-impatient Goto Github PK

View Code? Open in Web Editor NEW

This project forked from janert/d3-for-the-impatient

0.0 0.0 0.0 288 KB

Examples and code for the book "D3 for the Impatient"

Home Page: https://www.oreilly.com/library/view/d3-for-the/9781492046783/

d3-for-the-impatient's Introduction

D3 for the Impatient

Examples and code for the book D3 for the Impatient by Philipp K. Janert (O'Reilly, 2019).

D3 for the Impatient Book Cover

Description

This repository contains the source code and other files necessary to run the examples in the book. The repository also contains the code that was used to generate the figures in the book.

View Examples and Figures

You can view all examples and figures here.

Installation

To run the examples yourself (in order to play with and modify them), you need to download the files in the examples directory. You will also need to run a local web server to work with D3 and to run the examples.

To make running the examples as easy as possible, a version of the D3 library itself is included with the other files. All examples have been verified to work with this version of the D3 library (D3 Version 5.9.2, downloaded 15. Apr 2019).

Downloading the Source Code

To download the examples, you may clone the repository:

git clone git://github.com/janert/d3-for-the-impatient.git

Alternatively, download all the files as zipped archive from:

https://github.com/janert/d3-for-the-impatient/archive/master.zip

(or using the green button in the top right corner of this page), then unpack them using:

unzip d3-for-the-impatient-master.zip

Either way, the files necessary to run the examples are contained in the examples subdirectory.

Setting up a Web Server

To run the examples, you need to run a local web server. Several minimal web servers can be run without further configuration from the command line; many programming languages include ready-to-use web server modules as well. (See https://gist.github.com/willurd/5720255 for an extensive list of low-configuration web servers.)

Here are some examples of popular, lightweight web servers. By default, they all serve files from the directory they were started from, hence change into the examples directory before starting the server.

  • The D3 website recommends http-server, which is a Node.js package. If you have the Node runtime and the npm package manager installed, you can install and run a web server using:

    npm install -g http-server
    http-server -p 8080
    
  • Because they are part of its standard distribution, Python's web server modules are ubiquitious, but can be quite slow, even for development work:

    python -m http.server 8080               # Python 3
    python -m SimpleHTTPServer 8080          # Python 2
    
  • The busybox set of tools should be installed on all Debian-derived Linux distributions by default. Its built-in web server works well and is very fast:

    busybox httpd -p 8080
    

In all these examples, the server will be serving files from the directory that it was started in and listen on port 8080. (Most of the servers allow to specify a different directory on the command line; see the server-specific documentation.) The files in the server directory will be available at http://localhost:8080.

Running the Examples

Once the web server is running, point a JavaScript enabled browser to http://localhost:8080 or http://localhost:8080/index.html. The examples are organized by chapter, with all examples and figures on one single page per chapter. (The exception is Chapter 2, where there is a separate set of files for each example.)

Contributing

These files are intended to make it easier to learn D3, so feel free to modify them for your own purposes as you wish. Let me know if you have questions or suggestions.

Resources

Author

Philipp K. Janert

d3-for-the-impatient's People

Contributors

janert avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.