Anyway you need to have the data to compute the average... and usually you don't get the data point-by-point unless it is very low frequency acquisition.
If it is the case, you have to update your 2D vector point by point and then compute the average after each new point (much slower process indeed). You keep say 20 vectors of data and fill in the data (1, 2...20) and then( 1,2..20), so you compute the average on the last 20 acquisitions
(don't forget the rating)