Transition from integrable to chaotic domain in spectra of spin chains