Pie chart labels

	from org.jfree.chart.labels import StandardPieSectionLabelGenerator
	
	class LabelGenerator(StandardPieSectionLabelGenerator):
		def __init__(self, component):
			self.component = component
			StandardPieSectionLabelGenerator.__init__(self, "")
			
		def generateSectionLabel(self, dataset, key):
			defaultValues = self.createItemArray(dataset, key)
			return "{0}: {1} ({2})".format(
				key,
				self.component.data.getValueAt(dataset.getIndex(key), 1),
				defaultValues[2]
			)
	chart.plot.labelGenerator = LabelGenerator(self)

image

3 Likes