Book Image

Mastering D3.js

Book Image

Mastering D3.js

Overview of this book

Table of Contents (19 chapters)
Mastering D3.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 the version attribute and indicate that we will follow the Semantic Version specification:

!function() {
    var windmill = {version: '0.1.0'}; // semver
    // Charts
    windmill.chart = {};
    windmill...