Imaging the breaking of electrostatic dams in graphene for ballistic and viscous fluids