Trend example with Y axis change

<< Click to Display Table of Contents >>

Navigation:  Examples > Trends >

Trend example with Y axis change

Previous pageReturn to chapter overviewNext page

In the previous example, we could set the trend time range (X-axis) arbitrarily by clicking on it with the mouse and specifying the “Start” and “End” of the period in the pop-up window:




If we want to change the range of the Y axis we need to use a script.

Let's take the project from our previous example as a basis, where a tag and a graphic object have already been created and configured.


1. Let's create an intermediate tag named max, which will change the maximum trend range (Y-axis) through a script:




2. To set the value for the Y axis of the Trend DB, place a Slider on the screen and bind the max tag to it through the “Control” property:




3. We will also bind the value of the max tag to the maximum property of the Trend using the ST script. Let's create a script that will be called when the value of the max tag changes:




Let's write a script:



After you have recorded the script, be sure to launch it by clicking the button on the toolbar: runsimulation


4. Let’s Run simulation to check the settings (using the slider we will set the value for the Y-axis of the Trend):





You can download this project here.