Accepted answer

Well, if you are able to load data from your mysql database, in any case you will get it client-side in an object (array, map, whatever).

So there is no point writing a csv file from that to then extract the same data again.

You can do something like that:

mysql.load("whatever",function(err, yourData){
  if(err) return err;".somechart").selectAll(".someclass#someid")
    .data(yourData) // Feed data to your selection
    .enter() // enter the selection to modify it
    .append(".someclass#someid") // append some more elements to your selection
    // change attribute of each new element of the selection using yourData
      // i is the index of the element in the selection
      // d is equivalent to yourData[i]
      // if yourData is an array of {x,y} then
      return d.x;
      return d.y;

I suggest you have a look at (at least) this d3js tutorial, it will help you grasp how to work with d3 better.

Related Query

More Query from same tag