Visualizing UFO data
We'll spend a good bit of time visualizing the data, and we'll use the same system that we have in the previous chapters: a bit of HTML, a splash of CSS, and a lot of JavaScript, which we'll generate from ClojureScript.
We've already taken care of the configuration for using ClojureScript in the project.clj
file that I mentioned earlier. The rest of it involves a couple of more parts:
The code to generate the JSON data for the graph. This will be in the
src/ufo_data/analysis.clj
file. We'll write this code first.An HTML page that loads the JavaScript libraries that we'll use—jQuery (https://jquery.org/) and D3 (http://d3js.org/)—and creates a
div
container in which to put the graph itself.The source code for the graph. This will include a namespace for utilities in
src-cljs/ufo-data/utils.cljs
and the main namespace atsrc-cljs/ufo-data/viz.cljs
.
With these prerequisites in place, we can start creating the graph of the frequencies of the different shapes.
First, we need...