Drawing graphs with use of canvas