How to integrate a solution in one of its coordinates?

Have you tried integrating over a subdomain as done here?
If the mesh is very uniform and the function space P1 for example you could also try to manually sum over the values of the vertices which can be obtained by using
u.compute_vertex_values()
Hope that helps for a start.