fix getClosestStep() to work with data.legend