HELP on Graph Plotting!

Can anyone help me out with this? I attached the source file. It’s a graph plotting when user can enter values for a quadratic /cubic equation and it’ll plot the graph.

However, my problem is i wish to set the range when the graph will shown. That means if i enter -5 to 5, the graph will plots from that range. (i named it ak and bk) When i enter let’s say -5 to -1 and it will only show that range.

Another question, how do i set so the graph will fit dynamically into the screen exactly.

Thanx in advance!