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.
event.source.setMode(4)
How may I ask did you figure that out?
From this earlier post…
https://www.inductiveautomation.com/forum/viewtopic.php?f=24&t=3318&hilit=xtrace
[quote=“JordanCClark”]From this earlier post…
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
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
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)
Thank you AE2S_Sanden!
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
if event.propertyName == 'controlValue':
chart = event.source.parent.getComponent('Easy Chart')
chart.setMode(event.source.controlValue)
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!