# 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:** 1\
**Showing post:** 6

<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

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/easy-chart-pen-tooltips/52636)._
