Change the Legend of a Pie Chart

I have a pie chart where the legend is a bit long cause it is based on the Path column. How do I change it so the legend is based on the label column ?


Script transform is your friend here. Just manipulate your dataset in script to get the data you want in the column the pie chart is looking at. There may be other ways to do this, but script transform is an option.


Is the Path column important in any way? If not, I would just make a new DataSet within the script transform which omits the Path column. I believe the Pie Chart will look for a numeric column and a string column and map those columns to the slice values and labels by default.

def transform(self, value, quality, timestamp):
    # In this example, my DataSet has three columns: "s", "Int", and "x".
    # The Pie Chart is using "x" for the Legend, but I want it to use "s". I therefore make a new DataSet in
    # this transform using only the "Int", and "s" columns.
	return system.dataset.filterColumns(value, ["s","Int"])

I Resolve the problem by deleting the path column