# Trend X-Trace mode

**URL:** <https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426>\
**Category:** Ignition\
**Created:** [December 10, 2014, 3:54pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426 "2014-12-10T15:54:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![AE2S\_Sanden](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AE2S\_Sanden](https://forum.inductiveautomation.com/u/AE2S_Sanden)\
**Post date:** [December 10, 2014, 3:54pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/1 "2014-12-10T15:54:12Z")

</div>

The first thing I do when I view a trend is change to X-Trace mode. Is there a way to enable the X-Trace mode on a chart through scripting so it’s there automatically there on open? I can’t find the correct attribute.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [December 10, 2014, 5:54pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/2 "2014-12-10T17:54:04Z")

</div>

```auto
event.source.setMode(4) 
```

---

<div class="post-metadata">

**Author:** ![Pat](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Pat](https://forum.inductiveautomation.com/u/Pat)\
**Post date:** [December 11, 2014, 8:29pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/3 "2014-12-11T20:29:55Z")

</div>

How may I ask did you figure that out?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [December 11, 2014, 11:40pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/4 "2014-12-11T23:40:45Z")

</div>

From this earlier post…

[https://www.inductiveautomation.com/forum/viewtopic.php?f=24&t=3318&hilit=xtrace](https://www.inductiveautomation.com/forum/viewtopic.php?f=24&t=3318&hilit=xtrace)

---

<div class="post-metadata">

**Author:** ![Pat](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Pat](https://forum.inductiveautomation.com/u/Pat)\
**Post date:** [December 12, 2014, 7:46pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/5 "2014-12-12T19:46:51Z")

</div>

[quote=“JordanCClark”]From this earlier post…

[https://www.inductiveautomation.com/forum/viewtopic.php?f=24&t=3318&hilit=xtrace](https://www.inductiveautomation.com/forum/viewtopic.php?f=24&t=3318&hilit=xtrace)[/quote]  
Ok, because I didn’t see that in the user manual ![:/](https://us1.discourse-cdn.com/inductiveautomation/original/1X/8e510869ae26fbd7ab76e1e731ceea2054ef109c.gif "Hrm")

---

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [September 17, 2018, 6:59pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/6 "2018-09-17T18:59:50Z")

</div>

Hi guys,

I am new to Ignition and would like to implement this.

I tried putting “event.source.setMode(4)” inside the easy chart’s scripting (under Extension Functions-\>configureChart) but nothing seems to happen…

Regards,

D.Botha

---

<div class="post-metadata">

**Author:** ![AE2S\_Sanden](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AE2S\_Sanden](https://forum.inductiveautomation.com/u/AE2S_Sanden)\
**Post date:** [September 17, 2018, 7:29pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/7 "2018-09-17T19:29:42Z")

</div>

The command isn’t literally “event.source.setMode(4)”. It needs your event and your source. For example, below is part of the script I run when a window with a trend object opens to set the X-Trace mode. Click on the “Insert Property Reference” button to have it build the expression for you.

I’ve never tried it, but adding the script to the chart’s Extension Functions-\>configureChart like you’re trying to do should work too.

chart = system.gui.getParentWindow(event).getComponentForPath(‘Root Container.Easy Chart’)  
chart.setMode(4)

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8aa1c374e9d2f6a6e03941d229fe3dff80bf33bf.png)

---

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [September 17, 2018, 10:20pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/8 "2018-09-17T22:20:49Z")

</div>

Thank you AE2S\_Sanden!

---

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [September 18, 2018, 3:04pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/9 "2018-09-18T15:04:05Z")

</div>

Hi again,

I would like to use a multi-state button for selecting the mode.

I have put this code into the Multi-Start Button's Component Scripting -\> Property Change:

> chart = system.gui.getParentWindow(event).getComponentForPath('Root Container.Easy Chart')  
> if "Building 3/DI Water/Trend/Chart Mode 2" == 0:  
> chart.setMode(0)  
> elif "Building 3/DI Water/Trend/Chart Mode 2" == 1:  
> chart.setMode(1)  
> elif "Building 3/DI Water/Trend/Chart Mode 2" == 3:  
> chart.setMode(3)  
> elif "Building 3/DI Water/Trend/Chart Mode 2" == 4:  
> chart.setMode(4)

Unfortunately, nothing seems to happen. Any help would be appreciated!

Regards,

D.Botha

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 18, 2018, 4:28pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/11 "2018-09-18T16:28:02Z")

</div>

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b657b9166ec6c1fb755ba43f72bb42a536d3b761.PNG)

```python
if event.propertyName == 'controlValue':
  chart = event.source.parent.getComponent('Easy Chart')
  chart.setMode(event.source.controlValue)
  

```

---

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [September 18, 2018, 7:13pm UTC](https://forum.inductiveautomation.com/t/trend-x-trace-mode/9426/12 "2018-09-18T19:13:37Z")

</div>

Hi JordanCClark,

You got me on the right track - I tried your code but was getting an error. This worked for me:

> chart = system.gui.getParentWindow(event).getComponentForPath('Root Container.Easy Chart')  
> chart.setMode(event.source.controlValue)

Thanks!
