You can graph using the Canvas. This is what ABG is eluding to in the referenced link. You use the screen canvas coordinates to plot data.
Here are two key routines, one converts map coordinates to World coordinates, the other converts World coordinates to map (Canvas screen) coordinates.

and it will give you a graph where values become screen pixels:

to get the example x * 2 = y plot. Yes, you need quite a few global variables and the plotting routines.
Regards,
Steve