Tuning the phase transition in transition-metal-based magnetocaloric compounds