fix chart legent if statment