Change each bar width in histogram chart

I'm sorry you had trouble figuring out. I was able to adapt the tool tip script to your usage case. Here is the script:

#def configureChart(self, chart):
	from java.awt import BasicStroke, Color
	from org.jfree.chart.annotations import XYTextAnnotation
	plot = chart.getPlot()
	plot.setOutlineStroke(BasicStroke(1))
	plot.setOutlinePaint(Color.black)
	for annotation in plot.getAnnotations():
		if isinstance(annotation, XYTextAnnotation):
			plot.removeAnnotation(annotation)

	#This will be your WO datset, so correct the path accordingly
	labelData = self.parent.getComponent('Power Table 1').data
	
	barData = self.parent.getComponent('Power Table').data
	for row in range(0, labelData.rowCount - 1):
		text = str(labelData.getValueAt(row, 1))
		startTime = float(barData.getValueAt(row, 0).getTime())
		endTime = float(barData.getValueAt(row + 1 , 0).getTime())
		topBound = float(barData.getValueAt(row, 2))
		bottomBound = float(barData.getValueAt(row, 1))
		x = (startTime + endTime) * .5
		y = (topBound + bottomBound) * .5
		annotation = XYTextAnnotation(text, x, y)
		plot.addAnnotation(annotation)

Here is the result:

1 Like