# Change each bar width in histogram chart

**URL:** <https://forum.inductiveautomation.com/t/change-each-bar-width-in-histogram-chart/66847>\
**Category:** Ignition\
**Tags:** scripting, vision\
**Created:** [November 23, 2022, 11:49am UTC](https://forum.inductiveautomation.com/t/change-each-bar-width-in-histogram-chart/66847 "2022-11-23T11:49:56Z")\
**Posts on this page:** 1\
**Showing post:** 37

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [March 7, 2023, 12:25pm UTC](https://forum.inductiveautomation.com/t/change-each-bar-width-in-histogram-chart/66847/37 "2023-03-07T12:25:23Z")

</div>

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:

```auto
#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:

```auto
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:

> [@Show tooltipText in foreground of the Status Chart - Vision](https://forum.inductiveautomation.com/t/show-tooltiptext-in-foreground-of-the-status-chart-vision/69084/7):
>
> I finally developed a reliable way to achieve this result. Initially, I tried various label generators, but all I could get them to do is apply a single label to each series, so it appears that I was mistaken in my initial suggestion. What ended up working quite well are XYTextAnnotations. Below is a script that iterates through the chart data, and calculates the appropriate place to put the annotations. Since timeDiff is what was requested in the original post, in the below example, I calculat…

---

_[View the full topic](https://forum.inductiveautomation.com/t/change-each-bar-width-in-histogram-chart/66847)._
