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 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.