# Switching between datasets for chart with scripting

**URL:** <https://forum.inductiveautomation.com/t/switching-between-datasets-for-chart-with-scripting/44523>\
**Category:** Ignition\
**Tags:** scripting, ignition80\
**Created:** [March 16, 2021, 1:52pm UTC](https://forum.inductiveautomation.com/t/switching-between-datasets-for-chart-with-scripting/44523 "2021-03-16T13:52:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mitchel.Gommers](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@Mitchel.Gommers](https://forum.inductiveautomation.com/u/Mitchel.Gommers)\
**Post date:** [March 16, 2021, 1:52pm UTC](https://forum.inductiveautomation.com/t/switching-between-datasets-for-chart-with-scripting/44523/1 "2021-03-16T13:52:49Z")

</div>

Hi,

I having a box and whisker chart and a parameter power table. In the power table can I select a parameter. I want to switch between the dataset depending on the selected parameter in the power table. The datasets and the selected parameters are custom properties.

I used this script what i run in the property change of the box and whisker chart:

if event.source.parent.Selectedparameter == ‘Perstijd’:  
event.source.data = event.source.parent.Perstijd

if event.source.parent.Selectedparameter == ‘Persdruk’:  
event.source.data = event.source.parent.Persdruk

When I selected a different parameter the dataset of the box and whisker chart will not change. Can somebody see what I am doing wrong?

Thanks,  
Mitchel

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 16, 2021, 1:57pm UTC](https://forum.inductiveautomation.com/t/switching-between-datasets-for-chart-with-scripting/44523/2 "2021-03-16T13:57:41Z")

</div>

You need to define your property change event on the object and property that triggers the others–the selection on the power table. Or on the container of your box-and-whisker chart where the Selectedparameter property is located. The chart is a consumer of the changes, not the source.

---

<div class="post-metadata">

**Author:** ![Mitchel.Gommers](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@Mitchel.Gommers](https://forum.inductiveautomation.com/u/Mitchel.Gommers)\
**Post date:** [March 17, 2021, 8:11am UTC](https://forum.inductiveautomation.com/t/switching-between-datasets-for-chart-with-scripting/44523/3 "2021-03-17T08:11:22Z")

</div>

Thanks you it worked!
