Book Image

Clojure Data Analysis Cookbook - Second Edition

By : Eric Richard Rochester
Book Image

Clojure Data Analysis Cookbook - Second Edition

By: Eric Richard Rochester

Overview of this book

Table of Contents (19 chapters)
Clojure Data Analysis Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating histograms with NVD3


To show the distribution of our data, we generally use a histogram. In this recipe, we'll use a histogram to display the distribution of lengths in the abalone dataset.

Getting ready

We'll use the same dependencies and plugins in our project.clj file as we did in the Creating scatter plots with NVD3 recipe. Also, we'll use the framework we've created in the recipes in this chapter upto the Creating scatter plots with NVD3 recipe.

For the data, we'll use the abalone dataset from the Creating histograms with Incanter recipe. I've transformed the data to JSON, and you can download it from http://www.ericrochester.com/clj-data-analysis/data/abalone.json. Save it to the resources/data/ directory in your web application.

How to do it…

We'll create the handler and the routes and then we'll spend most of this recipe in adding the ClojureScript to create the graph. To do this, perform the following steps:

  1. For the handler, we'll pass the options for this chart to the d3-page...