# Getting and Setting Bar Chart tooltips

**URL:** <https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754>\
**Category:** General Discussion\
**Created:** [November 6, 2015, 10:19pm UTC](https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754 "2015-11-06T22:19:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [November 6, 2015, 10:19pm UTC](https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754/1 "2015-11-06T22:19:37Z")

</div>

Is there a way to override the functionality for the bar chart’s tooltips? I’m trying to find a way to change what is displayed when you mouse over one of the bars. I was hoping there would be an easy way to find what the default value would be, change it, and then write back the text I want.

The getToolTipText() and setToolTipText() functions get and set the Mouseover Text, which is what appears when your mouse is not over a bar. Is there a feature in here that I’m missing?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 6, 2015, 10:41pm UTC](https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754/2 "2015-11-06T22:41:10Z")

</div>

Hi, Dan,

Not out of the box, but Phil Turmel has mad a module for such things.

[https://inductiveautomation.com/forum/viewtopic.php?f=89&t=13874&p=50555&hilit=Note#p50555](https://inductiveautomation.com/forum/viewtopic.php?f=89&t=13874&p=50555&hilit=Note#p50555)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 6, 2015, 11:49pm UTC](https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754/3 "2015-11-06T23:49:15Z")

</div>

[quote=“JordanCClark”]Hi, Dan,

Not out of the box, but Phil Turmel has mad a module for such things.

[https://inductiveautomation.com/forum/viewtopic.php?f=89&t=13874&p=50555&hilit=Note#p50555](https://inductiveautomation.com/forum/viewtopic.php?f=89&t=13874&p=50555&hilit=Note#p50555)[/quote]Sadly, it doesn’t add anything to bar chart tooltips. In fact, the classic NoteChart doesn’t support bar charts at all. (It’s built for time series historical data.)

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [November 9, 2015, 3:49pm UTC](https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754/4 "2015-11-09T15:49:34Z")

</div>

Add the following to the bar chart's property change script.

> [@](#):
>
> if event.propertyName == "data":  
> from org.jfree.chart.labels import CategoryToolTipGenerator
> 
> ```
> class CustomToolTipGenerator(CategoryToolTipGenerator):
> def generateToolTip(self,dataset,row,column):
> return "TIP: %s = %d %%"%(dataset.getRowKey(row),(dataset.getValue(row,column)))
> 
> 	
> chart = event.source.getChart()
> renderer = chart.getPlot().getRenderer()
> renderer.setToolTipGenerator(CustomToolTipGenerator())
> 
> ```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 9, 2015, 4:27pm UTC](https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754/5 "2015-11-09T16:27:02Z")

</div>

[quote=“jpark”]Add the following to the bar chart’s property change script.

[code]if event.propertyName == “data”:  
from org.jfree.chart.labels import CategoryToolTipGenerator

```
class CustomToolTipGenerator(CategoryToolTipGenerator):
	def generateToolTip(self,dataset,row,column):
		return "TIP: %s = %d %%"%(dataset.getRowKey(row),(dataset.getValue(row,column)))

chart = event.source.getChart()
renderer = chart.getPlot().getRenderer()
renderer.setToolTipGenerator(CustomToolTipGenerator())

```

[/code][/quote]Sweet!

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [November 10, 2015, 8:36pm UTC](https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754/6 "2015-11-10T20:36:11Z")

</div>

Brilliant! That got me started, and a combination of google, trial, and error got me the exact tooltips I was looking for.

Many thanks.
