One of the problems I’ve been trying to figure out is how to take a d3.js graph and populate it with data from a database. I have been working through this tutorial to better understand posting to a database and retrieving the data. Having gone through the tutorial, I’m taking the resulting pieces, changing the type of data being posted and am working on resurrecting the data.
I’m still not understanding whether I should build the charts so they render via the server or if there is a way I can draw the data from the database by making a request to the server from the front end. I’m sure my understanding is incomplete at the moment. I am researching front end frameworks to see if there is anything that can make this easier for me.
The objective here is to create a chart that updates live, so it would make sense to use a framework that does data-binding. I know angular is popular but I have been wary of it as I know it is going through a major change to 2.0 so for now I’ll use knockout.js which seems to offer the functionality I’m looking for.
In trying shortcut my understanding how d3 and knockout might work together, a google search on how to combine the two brought up this tutorial, which I hope even though it is a little old will provide some insight. In skimming over the tutorial I realize I need to get a better understanding of the knockout api, so I’m going to immerse myself in the documentation for a bit to try and grasp it better. My main interest is in understanding how it interacts and integrated with a mongodb database.
As I dig more into the learning knockout.js I realize in order to make my data more accessible I may need to create some kind of restful api for my basic CRUD app so that I can better access and manipulate the data. I’m going to dig into the knockout.js first and play with it and after I get a handle on it I’ll put together a restful api, most likely with some kind of library such as restful.