Stalking, threats and assaults are putting people off standing for election, local government groups warn.