# Custom Properties on Charts

**URL:** <https://forum.inductiveautomation.com/t/custom-properties-on-charts/5577>\
**Category:** Ignition\
**Created:** [December 13, 2012, 8:24pm UTC](https://forum.inductiveautomation.com/t/custom-properties-on-charts/5577 "2012-12-13T20:24:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [December 13, 2012, 8:24pm UTC](https://forum.inductiveautomation.com/t/custom-properties-on-charts/5577/1 "2012-12-13T20:24:40Z")

</div>

Is it possible to dynamically create a custom property for a chart?

I am making a very complicated chart that could need between 5 and 10 custom properties. Is there a way I could add a property using scripting?

event.source.getComponent(‘Chart’).addProperty(dataset7), or something that would function like this?

Thanks,

Mike

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [December 13, 2012, 9:58pm UTC](https://forum.inductiveautomation.com/t/custom-properties-on-charts/5577/2 "2012-12-13T21:58:45Z")

</div>

Sorry, there isn’t a way to add datasets to the chart through scripting. I think in your case you just need to add the max number of datasets you will ever need like 10. You can enable/disable ones that you don’t want to use like this:`chart = event.source.parent.getComponent('Chart')
chart.setDatasetEnabled("Data", 1)`You can set it to a 0 or 1.

---

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [December 14, 2012, 1:50pm UTC](https://forum.inductiveautomation.com/t/custom-properties-on-charts/5577/3 "2012-12-14T13:50:45Z")

</div>

Cool.

That being established, is there any way to iterate through them?

while i \<10  
chart.data(i) = listOfDatasets(i)  
i += 1

I know that the above code would would obviously fail, but is there any way we might be able to achieve the same effect?

This graph is complicated and giving me all sorts of issues.

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [December 14, 2012, 7:24pm UTC](https://forum.inductiveautomation.com/t/custom-properties-on-charts/5577/4 "2012-12-14T19:24:03Z")

</div>

Yeah, you have to call out the datasets by name but you can create a list of them to make it easy.`chart = event.source.parent.getComponent('Chart')
datasetNames = ["data1", "data2", "data3", "data4"]
for name in datasetNames:
	chart.setDatasetEnabled(name, 1)`

---

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [December 17, 2012, 4:51pm UTC](https://forum.inductiveautomation.com/t/custom-properties-on-charts/5577/5 "2012-12-17T16:51:44Z")

</div>

Is there a way to make a list of the actual dataset objects themselves?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [December 17, 2012, 5:01pm UTC](https://forum.inductiveautomation.com/t/custom-properties-on-charts/5577/6 "2012-12-17T17:01:22Z")

</div>

Not really. You will have a static list of properties since you can’t make them dynamically.
