# Easy Chart; dynamic number of plots based on tags on Easy Chart not working

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-dynamic-number-of-plots-based-on-tags-on-easy-chart-not-working/91101>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [May 29, 2024, 7:02pm UTC](https://forum.inductiveautomation.com/t/easy-chart-dynamic-number-of-plots-based-on-tags-on-easy-chart-not-working/91101 "2024-05-29T19:02:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [May 29, 2024, 7:02pm UTC](https://forum.inductiveautomation.com/t/easy-chart-dynamic-number-of-plots-based-on-tags-on-easy-chart-not-working/91101/1 "2024-05-29T19:02:34Z")

</div>

I have an easy chart setup with a pressure, temperature and level. I want to create a template which enables the use of a template repeater which the user can use a dropdown menu to pick the plot number to display the data. I have the template working using a script and its based on the number of tags in the easy chart. When I use the repeater it is not updating correctly.

Here is my template:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/0/30b17981647248ae3274c64a79497a65b967e251.png)

Here is the dataset view

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8f893a9d8d00f1a1a5dea25add91887a10b360ac.png)

Here is the binding in the dataset:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f6bcf0b469b49197fc1b658027f1dcbcbd403b16.png)

numPlots is a template parameter

Here is the script:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/9/59e31d32e8acf02d9beac418ce00142f6b7f6aae.png)

On a screen I have the template repeater using the Plot DropDown template

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 30, 2024, 9:51am UTC](https://forum.inductiveautomation.com/t/easy-chart-dynamic-number-of-plots-based-on-tags-on-easy-chart-not-working/91101/2 "2024-05-30T09:51:38Z")

</div>

My inclination is to get rid of the runscript expression binding, and just use a property change script on the template itself to update the dropdown.

**Something like:**

```python
# Run at initialization and any time the template repeater changes the numPlots property
if event.propertyName in ['componentRunning', 'numPlots']:
	headers = ['value', 'label']
	data = [[index + 1, 'Plot {}'.format(index + 1)] for index in xrange(event.source.numPlots)]
	event.source.getComponent('Dropdown').data = system.dataset.toDataSet(headers, data)

```

Then, assuming the template repeater is in dataset mode, a propertyChange script on the easy chart could drive the `numPlots` and `tagLabel` parameters:

```python
# Run at initialization and any time tags are added or removed
if event.propertyName in ['componentRunning', 'tagPens']:
	# Allow for each tag pen to potentially have its own subplot, and put the name of the pen in the template's labelText property
	tagPens = event.source.tagPens
	templateParameters = system.dataset.toDataSet(['numPlots', 'tagLabel'], [[tagPens.rowCount, tagPens.getValueAt(index, 'NAME')] for index in xrange(tagPens.rowCount)])
	event.source.parent.getComponent('Template Repeater').templateParams = templateParameters

```

Note that the component running event doesn't occur in the designer unless the designer is already in preview mode when the window is opened.
