Basic Javascript Canvas function grapher