Creating the package contents

We will create a small package containing a heat map chart and a layout function. We begin by choosing a name for our project, creating an empty directory, and initializing the repository. The name of our package will be Windmill. Once we have created the directory, we can create the initial content. We will organize the code in components and implement the chart and the helper functions in separate files. The source code will be organized in folders, one for each component. Later, we will concatenate the files in the correct order to generate the windmill.js file, containing all the components of the package:

src/
   chart/
      chart.js
      heatmap.js
   layout/
      layout.js
      matrix.js
   svg/
      svg.js
      transform.js
   start.js
   end.js

We add ...

Get D3.js: Cutting-edge Data Visualization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.