Added error checking in stacked bar directive