I think you need the function (EDIT: curve; please see below) to be injective; otherwise you have cases like that of a space-filling curve :http://en.wikipedia.org/wiki/Space-filling_curve . If you want to turn it into a function $f: \mathbb R \rightarrow \mathbb R$ , then you can extend continuously left and right. The existence of the continuous extension is guaranteed, e.g., by Tietze extension theorem.
EDIT: like was pointed out, this is not actually a function, but a curve (and I wrongly assumed you meant a curve, not a function). For a function, consider a ball about the pair $(x,f(x))$. Since f is a function, any ball $B((x,f(x));r)$ for any $r>0$ cannot contain any horizontal strip above $f(x)$, so the image must contain an empty interior. Say there is a closed ball $B$ in the graph. This ball will then contain a small vertical strip , which implies that some point in the domain has two images, which cannot happen for a function.