int casting for index in legend for multiple tests