# Programmatically Setting Selection on chart

**URL:** <https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990>\
**Category:** Archived Topics\
**Created:** [February 12, 2009, 8:32pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990 "2009-02-12T20:32:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [February 12, 2009, 8:32pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990/1 "2009-02-12T20:32:38Z")

</div>

I see there is a method to clear the selection on a chart. Is there a way to set a point as selected? I was thinking something along the lines of:

setSelection(x\_point,y\_point)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [February 13, 2009, 4:10pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990/2 "2009-02-13T16:10:19Z")

</div>

Sorry, no, there currently isn’t a way to set the selected point. I’ve taken the liberty of moving this thread to the feature request forum, we’ll see what we can do.

---

<div class="post-metadata">

**Author:** ![cmaynes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmaynes/32/6852_2.png) [@cmaynes](https://forum.inductiveautomation.com/u/cmaynes)\
**Post date:** [May 20, 2022, 2:33pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990/3 "2022-05-20T14:33:45Z")

</div>

Over 10 years later.  
I am on 7.9.17 and Windows.

Was this feature ever added?  
If not, is there a workaround?

---

<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:** [May 20, 2022, 2:51pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990/4 "2022-05-20T14:51:24Z")

</div>

I implemented it for XTrace in my NoteChart module. That’s pretty much it.

---

<div class="post-metadata">

**Author:** ![cmaynes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmaynes/32/6852_2.png) [@cmaynes](https://forum.inductiveautomation.com/u/cmaynes)\
**Post date:** [May 20, 2022, 3:06pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990/5 "2022-05-20T15:06:15Z")

</div>

Thanks for the reply @pturmel, but I cannot justify spending a few hundred dollars on a 3rd party module, just for this feature.  
It’s a shame IA never added this feature. It seems like it would be useful to many.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 20, 2022, 3:15pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990/6 "2022-05-20T15:15:08Z")

</div>

With sufficient scripting know-how, I think you could reflectively call the otherwise-hidden [`_setSelectedXValue()`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.16/com/inductiveautomation/factorypmi/application/components/chart/PMILineChartPanel.html#_setSelectedXValue(java.lang.String)) method on the `PMILinechartPanel`.

---

<div class="post-metadata">

**Author:** ![cmaynes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmaynes/32/6852_2.png) [@cmaynes](https://forum.inductiveautomation.com/u/cmaynes)\
**Post date:** [May 20, 2022, 3:51pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990/7 "2022-05-20T15:51:19Z")

</div>

@PGriffith, would it be possible for you to provide an example?  
This function takes a string. I have a numeric domain axis in the Chart component. Converting my domain axis value to a string does not seem to work.  
The documentation does not explain this and the term “domainAnchor” shows up in the docs on the page you point to, but it doesn’t seem to be explained anywhere.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 20, 2022, 3:58pm UTC](https://forum.inductiveautomation.com/t/programmatically-setting-selection-on-chart/990/8 "2022-05-20T15:58:39Z")

</div>

Perhaps `setAnchor(Point2D(x, y))`, then?

I don’t have an example because I haven’t done this.
