I am trying to set up a graph like this http://bl.ocks.org/4063269#index.html with d3.js:

I need to do this by putting methods in a controller and the js in a .html.haml file. I have made the controllers, but have absolutely no idea how to write the methods.
The methods need to take values from a sqlite3 database and convert it into JSON for the d3.js to use. Could someone get me started? I have no idea what to do right now…
Unfortunately the question you are making is too open, with more details you will get more help 😉
So the javascript library is going to make ajax call to your application, and your application should respond with json?
In that case, you can just do the routing on config/routes.rb, and then you just write a method like this:
And your js should request something like http://mywebsite.com/values_for_js.json (or it can say in the ajax request that a json format is expected). If you are not able to make the json request, you can just use format.js instead of format.json