draw graph according to screen width