try switching your selectAll statement to:
svg.selectAll("rect.negative").remove()
This should select the tags rect with class negativealthough I’m not 100% sure it will find it because the attr class is written as bar negative. If it doesn’t work I might try changing your class attribute to something like negative bar or just negative.
Sorry if this doesn’t help!