This is an illustration of the use of mongoDB with D3.js: a D3-based graph that is connected to a mongoDB database
grab_anscombe.R
– an R script to pull the data for Anscombe's quartet from Wikipediaanscombe_quartet.json
– JSON file with the datamongo_insert.py
– python script to insert the data into a mongoDB database (database"anscombe"
and collection"quartet"
)mongo_request.py
– python script setting up local server to handle requests to the mongoDB database. Go tohttp://localhost:8080/anscombe/I
to get the first dataset; then/II
,/III
, and/IV
.anscombe.coffee
– coffeescript to make the plot; uses thescatterplot
function in d3panels.
- Start the mongoDB daemon,
mongod
. - Run
mongo_insert.py
to insert the data fromanscombe_quartet.json
into the database.
- Start the mongoDB daemon,
mongod
. - Run
mongo_request.py
to start the database server. - Open
index.html
in a browser. (Note: don't go tolocalhost:8080
which is just used for the data; rather, just openindex.html
asfile:///.../index.html
)