Make axis dynamic, fix several bugs

Make axis's position dynamic, remove undesirable lines which are
drawn when the graph is discontinuous, check y-min < y-max and
x-min < x-max