made legend update correctly when stages change, swapped legend colors over to data-code attr for style selection
fixed division not returning colors problem