# EasyChart XTraceLabel with multiple pens

**URL:** <https://forum.inductiveautomation.com/t/easychart-xtracelabel-with-multiple-pens/15779>\
**Category:** Ignition\
**Created:** [October 26, 2017, 9:50am UTC](https://forum.inductiveautomation.com/t/easychart-xtracelabel-with-multiple-pens/15779 "2017-10-26T09:50:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Myllka](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/myllka/32/4140_2.png) [@Myllka](https://forum.inductiveautomation.com/u/Myllka)\
**Post date:** [October 26, 2017, 9:50am UTC](https://forum.inductiveautomation.com/t/easychart-xtracelabel-with-multiple-pens/15779/1 "2017-10-26T09:50:08Z")

</div>

Hi,

I’m having trouble with the getXTraceLabel function from the easyChart.  
I have 2 kind of pens: one with usual float value, no problem with this one, and another which has some status (3 for now) and an associated message to put in the label. I pass through a dataset in the custom properties of the root to get the label and the date. The thing here is with self.selectedXValue, I only have the first pen date. I tried to get the closer date to the selectedXValue, but it’s not working well, especially when you have many values for the second between two of the first.

Here is how it looks like:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/9204d7406664e9a8d05ac6b56649220f4f656548.jpg)

Any idea to get the right date value ? I’ld like to avoid using a subplot for now.

Thanks !

---

<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:** [October 26, 2017, 1:07pm UTC](https://forum.inductiveautomation.com/t/easychart-xtracelabel-with-multiple-pens/15779/2 "2017-10-26T13:07:29Z")

</div>

I’m pretty sure you’ll have to swap the order of your pens. If I recall correctly, the standard X-Trace locates off the first pen’s dataset. I rewrote the X-Trace functionality when I created the [NoteChart Module](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-notechart) – my NoteChart and EasyNoteChart components interpolate instead of jumping to a specific data point’s timestamp.

---

<div class="post-metadata">

**Author:** ![Myllka](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/myllka/32/4140_2.png) [@Myllka](https://forum.inductiveautomation.com/u/Myllka)\
**Post date:** [October 26, 2017, 2:30pm UTC](https://forum.inductiveautomation.com/t/easychart-xtracelabel-with-multiple-pens/15779/3 "2017-10-26T14:30:39Z")

</div>

Just tried it, nothing change 😕

---

<div class="post-metadata">

**Author:** ![Myllka](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/myllka/32/4140_2.png) [@Myllka](https://forum.inductiveautomation.com/u/Myllka)\
**Post date:** [October 27, 2017, 8:11am UTC](https://forum.inductiveautomation.com/t/easychart-xtracelabel-with-multiple-pens/15779/4 "2017-10-27T08:11:03Z")

</div>

I’m now tring to use the JFreeChart object in both configureChart and getXTraceLabel functions with [CustomXYToolTipGenerator](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/labels/CustomXYToolTipGenerator.html).

In the first one I’m stuck at chart.getXYPlot().getDataset(numDS).getItemCount(numSerie) which return 0. Note that I get the right pen name with chart.getXYPlot().getDataset(numDS).getSeriesKey(numSerie).

In the second one, the chart object itself returns none. That’s very strange.
