Dealing with function plotting in javascript, this is everything you need.