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?
pturmel
November 6, 2015, 11:49pm
3
[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 [/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.)
jpark
November 9, 2015, 3:49pm
4
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())
2 Likes
[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!
Brilliant! That got me started, and a combination of google, trial, and error got me the exact tooltips I was looking for.
Many thanks.