Black Lives Matter. Please consider donating to Black Girls Code today.

Computation upon zooming the graph

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?

Anyone has updates on this matter?