Data Filed and Graphics

Hi everyone

I wish to create a DataField allowing to plot a GPS route. For that I would like to draw a point every seconde, as a function of latitude and longitude. I wrote the following code. However it does not work properly. It indeed seems that the screen is refreshed. So I have not a route, but only 1 point…

My mistake must be obvious but I don't see it.

Thanks for your help.  

function onUpdate(dc as Dc) as Void

    {

       var x,y as Float;

        y = (mLat-mLat0)*3000;

        x = (mLon-mLon0)*Math.cos((mLat0)*0.0175)*3000;

        dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_WHITE);

        dc.drawPoint(208+Math.floor(x), 208-Math.floor(y));

   }