adding if condition to take into account when the first slice in the pie is of a single value, but the other slices or layers have multiple values. This fix causes the legend to be displayed where it previously wasn't.