I’m pretty new to D3 and I’m not sure how to read data from a mySQL database for my basic line graph http://bl.ocks.org/5fc4cd5f41a6ddf2df23 At the moment just reading data from an array in order to set the graph up initially.
I’ve read this http://www.jeromecukier.net/blog/2012/01/02/using-d3-with-a-mysql-database/ but unclear as to how to can adapt this for my graph, and if is the best method of doing this?
Would ideally like to get this accomplished as simply as possible so can get my head around it before I attempt anything more complicated – any help would be appreciated?
I would recommend translating the array (that you get from your mysql request) from the PHP to JSON with json_decode() and pulling the actual data with an $.ajax request with a little help from jQuery.
Then you can use the JSON data to draw the D3 visualization.
PS: If you’re not familiar with D3 you should see this http://alignedleft.com/tutorials/d3/.
PPS: JSON.parse() only works with the JSON2.js library.