<< Click to Display Table of Contents >>
Add and remove curve to/from trend dynamically
If we want to add and remove curves to/from trend dynamically you also have to use scripts.
First let's create 2 tags based on Tag1 from previous example. Name them Tag2 and Tag3.
Second let's create 2 tags - Add and Remove. When value of these tags are changed from FALSE to TRUE we add or remove curve.
Third let's create tag - Number. This tag will contain information about which tag we want to add or remove. All our tags looks like below:
Let's bind Add and Remove tags to the Control property of the Button:
Let's bind tag Number to the ComboBox object and fill up ranges collection by tag's names:
Now let's create 2 scripts for adding and removing curves:
Below text of the script to add curve. We use addcurve function from Trend's curve library:
Below text of the script to remove curve:
We need to bind these scripts to the tags- Add and Remove:
Now when we click buttons Add and Remove we call correspondent scripts.
Let's Run simulation to check your settings:
You can download this project here.