move pie chart label drawing to function (to allow refresh on dataset delete)
code cleanup: better handling of dataset tracking