D3 is a great library, whose pretty clever design is the result of many years of research. It is the descendant of Protovis, a library that was already very nice at its time. Then the author, Mike Bostock, moved on to something more dynamic (differences are outlined here).
There is a fair amount of weirdness at first sight in D3. The ways you bind visual elements to the data, respond to changes, update the graphs, etc. may not seem intuitive at first. But after a few experiments, following the numerous tutorials and reading the extensive documentation, you become quite productive.
In a first order approximation, you can think of D3 as an SVG canvas. It allows you to create and manipulate, not unlike jQuery, the SVG DOM in an efficient, cross-browser manner. Then realize you can, instead of manually creating SVG nodes, define systematic (i.e. declarative) mappings from data to visual elements. On top of that, D3 allows you do customize, animate, let the user interact with the graph - and many more things.
Regarding your question about the architecture, I think the SO question you link to answers most of it. Yes, it is sound, and it is the way to go if you want to pull your data from a RDMS.
The way we usually design D3 apps is the following:
- assume your application is going to eat JSON data - you can always turn other formats to JSON on the server-side, and JSON is much more flexible than all other formats (except perhaps XML but once you've tried to
json_encode() a PHP array, you never look back).
- create a static
index.html file, putting the necessary boostrapping code in a companion
app.js file (and a maybe a CSS - the usual stuff). You may want to use one of the examples as a starting point.
- create a static
data.json file in the exact format you expect the server to send your data. Put some sample data inside. You can also put this JSON data directly inside your
- work on your frontend logic, refine the JSON data format, etc. until you have a decent prototype.
- setup a simple web server (e.g. Apache), have it serve the JSON file, and make your prototype work with this instead of the local file
- create a server-side script that generate the same "static" file (e.g. using PHP). Test your app.
- have the PHP script connect to the database, generate the JSON file on the fly and send it
Now you can work on improving the application: defining different URLs to pull different data streams, create means for the user to filter the data, etc.
These are just ideas to get started. The point here is to minimize the amount of changes between each step, so you learn things one by one, and keep focused on the parts that are really difficult: the client application. Binding to a server that generates real-time data is just a step forward once you have a good app.