# Easy Chart Pen ToolTips

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636>\
**Category:** Ignition\
**Created:** [November 2, 2021, 5:21pm UTC](https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636 "2021-11-02T17:21:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eckman.tech](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eckman.tech/32/45147_2.png) [@eckman.tech](https://forum.inductiveautomation.com/u/eckman.tech)\
**Post date:** [November 2, 2021, 5:21pm UTC](https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636/1 "2021-11-02T17:21:30Z")

</div>

Need some help with the Easy Chart configureChart method. I am trying to change the mouse hover over tooltip on pens to display the tag documentation property from the tag itself.

The problem I’m having is figuring out how to expose and update the jfree chart for the mouse over tooltips on pens.

Has anyone accomplished this? I’ve searched through the forums and couldn’t find any straight forward solution.

---

<div class="post-metadata">

**Author:** ![john.eichler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/john.eichler/32/24632_2.png) [@john.eichler](https://forum.inductiveautomation.com/u/john.eichler)\
**Post date:** [June 1, 2022, 1:58am UTC](https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636/2 "2022-06-01T01:58:06Z")

</div>

Bump. I’d like to be able to change the numeric format of these tool tips. Any ideas?

---

<div class="post-metadata">

**Author:** ![eckman.tech](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eckman.tech/32/45147_2.png) [@eckman.tech](https://forum.inductiveautomation.com/u/eckman.tech)\
**Post date:** [November 3, 2022, 1:31pm UTC](https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636/3 "2022-11-03T13:31:28Z")

</div>

Bump. This has come up as a request again.

---

<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:** [November 3, 2022, 1:39pm UTC](https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636/4 "2022-11-03T13:39:03Z")

</div>

> [@eckman.tech](#):
>
> expose and update the jfree chart

@pturmel showed us how to expose the chart [here](https://forum.inductiveautomation.com/t/easy-chart-accessing-the-datasets-being-rendered/8709/9), and he exposes a lot of hidden properties in his [Note Chart Module](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-notechart)

Below is a recent forum example of his code being used to find the mode. I'm sure you could adapt it for this purpose:

> [@Get Chart (not Easy Chart) mode in script](https://forum.inductiveautomation.com/t/get-chart-not-easy-chart-mode-in-script/35662/14):
>
> For the Easy Chart, I tested [@pturmel's approach](https://forum.inductiveautomation.com/t/easy-chart-accessing-the-datasets-being-rendered/8709/9) combined with [@klpe's method](https://forum.inductiveautomation.com/t/get-chart-not-easy-chart-mode-in-script/35662/11) for getting the radio buttons, and it works perfectly. However, if work is to be done with the code, there is no need to do the work every time the mouse enters the chart or every time the mouse enters some component on the chart, so rather than develop listeners, I simply added a custom component to the chart's parent container called oldMode. I then use the mode to evaluate whether or not work needs to be done at the…

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 3, 2022, 1:46pm UTC](https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636/5 "2022-11-03T13:46:38Z")

</div>

Here is an example of creating a customMouseListener, which is what you will need. I think this example was for a Standard Chart component, but it will work for an easy chart as well. It's not exactly what you're looking for but its a pretty good start.

> [@Jfree chart - click on rendered data point](https://forum.inductiveautomation.com/t/jfree-chart-click-on-rendered-data-point/38066/12):
>
> This should do the trick: from org.jfree.chart import ChartMouseListener class CustomChartMouseListener(ChartMouseListener): def chartMouseClicked(self,e): xyItem = e.getEntity() #gets the data entity that was clicked, None if no entity was clicked if xyItem: #ensure that a data entity was clicked dataset = xyItem.getDataset() xValue = dataset.getXValue(xyItem.getSeriesIndex(),xyItem.getItem()) yValue = dataset.getYValue(xyI…

---

<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:** [November 10, 2022, 9:22am UTC](https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636/6 "2022-11-10T09:22:59Z")

</div>

@eckman.tech - I experimented with this, and I was able to manipulate the format of an easy chart's tool tips using a button's actionPerformed event handler. It should be easy to modify the method for any usage case. Here is the code:

```auto
from org.jfree.chart.labels import StandardXYToolTipGenerator
renderer = event.source.parent.getComponent('Easy Chart').getComponent(0).getComponent(0).chart.getPlot().getRenderer()
xFormat = renderer.getBaseToolTipGenerator().getXFormat().getInstance()
yFormat = renderer.getBaseToolTipGenerator().getYFormat().getInstance()
xFormat.applyPattern("00.0#")
renderer.setBaseToolTipGenerator(StandardXYToolTipGenerator("{2}% Full", yFormat, xFormat))

```

**Tool tip before edit:**  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/b/8b24c6f5cf9d2adc781edb6f8492e0a922683908.png)

**Tool tip after edit:**  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9fb833fa3e71b300d9fea9a335916411f60a98c6.png)

The key is the is the first field in the StandardXYToolTipGenerator. Using reflection, I was able to determine that the `DEFAULT_TOOLTIP_FORMAT = "{0}: ({1}, {2})"` where `{0}` is the field, `{1}` is the y axis, and `{2}` is the x axis.

The format string behaves like a [MessageFormat](https://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html), but for the xFormat, you will have to modify the format using the methods in [java.txt.NumberFormat](https://docs.oracle.com/javase/7/docs/api/java/text/NumberFormat.html) prior to applying the tool tip generator. Likewise the yFormat will have to be modified using the methods in [java.text.DateFormat](https://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html).

Finally, the `getRenderer()` method does not apply to all plots, so if you are using a piePlot for example, simply omit it, and use a [StandardPieToolTipGenerator](https://www.jfree.org/jfreechart/api/javadoc_old/org/jfree/chart/labels/StandardPieToolTipGenerator.html) instead of a [StandardXYToolTipGenerator](https://www.jfree.org/jfreechart/api/javadoc_old/org/jfree/chart/labels/StandardXYToolTipGenerator.html):

```auto
toolTipGenerator = event.source.parent.getComponent('Easy Chart').getComponent(0).getComponent(0).chart.getPlot().getToolTipGenerator()
#	.getLabelFormat() = {0}: ({1}, {2})
#	.getNumberFormat() = java.text.DecimalFormat
#	.getPercentFormat() = java.text.DecimalFormat

```
