Computation upon zooming the graph

Hi
I want to display the average of the graph that i’m seeing. that means that If i zoom into a part of the graph, I want to display the
average which belong to the zoomed part.
Is there a way for binding a function/custom function to zoom event or such in python?
thanks,
Hagay.

Anyone has updates on this matter?