Change each bar width in histogram chart

You could experiment with adding a custom label generator. Expanding upon the configureChart extension function code that you are using to create that border, the code will end up looking something like this:

#def configureChart(self, chart):
	from java.awt import BasicStroke, Color
	from org.jfree.chart import labels
	from org.jfree.chart.renderer.xy import XYStepAreaRenderer
	
	#This will be your WO datset, so correct the path accordingly
	labelData = self.parent.getComponent('Power Table 3').data
	
	class CustomLabelGenerator(labels.XYItemLabelGenerator):
		def generateLabel(self, dataset, series, item):
			woNum = labelData.getValueAt(item, 1)
			label = str(woNum)
			return label
	plot = chart.plot
	plot.setOutlineStroke(BasicStroke(1))
	plot.setOutlinePaint(Color.black)
	renderer = plot.renderer
	generator = CustomLabelGenerator()
	renderer.setSeriesItemLabelGenerator(0, generator)
	renderer.setSeriesItemLabelsVisible(0, True)

That chart is going to have multiple renderers, so it is possible that you will need to build a function that finds the specific renderer that you want to set the label generator to. It will look like this:

from org.jfree.chart.renderer import #The renderer you are looking for
def getRenderer(plot):
	for renderer in range(plot.rendererCount):
		plotRenderer = plot.getRenderer(renderer)
		print plotRenderer
		if isinstance(plotRenderer, #The renderer you are looking for):
			return plotRenderer
plot = chart.plot
renderer = getRenderer(plot)

Since this is an XYPlot, XYText annotations would also be an option. Just convert the date in the dataset to millis for the domain axis location, and use the bar chart value for the range axis location. Here is an example of this that I developed for a status chart:

2 Likes