# Vision Classic Chart - change Dataset Properties in scripting

**URL:** <https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [February 15, 2023, 4:47pm UTC](https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905 "2023-02-15T16:47:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwhite](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bwhite/32/7112_2.png) [@bwhite](https://forum.inductiveautomation.com/u/bwhite)\
**Post date:** [February 15, 2023, 4:47pm UTC](https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905/1 "2023-02-15T16:47:03Z")

</div>

I am trying to make some changes to an existing application that used the Vision Classic Chart component. I need to add a dataset but enable it using scripting. I cannot find the syntax for the dataset properties script to turn on the enable bit. Can anyone point me to the list of scripting for these properties?

I've tried these:  
event.source.chartDataSet1.enable  
event.source.chartDataSet1.dataset.enable

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 15, 2023, 6:10pm UTC](https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905/2 "2023-02-15T18:10:13Z")

</div>

I'm not sure exactly what you mean? If you add a data set to the chart, then it is automatically enabled.

Or are you trying to add a data set to the JFreeChart object itself?

Perhaps a screen snip of what you expected vs. what you got?

---

<div class="post-metadata">

**Author:** ![bwhite](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bwhite/32/7112_2.png) [@bwhite](https://forum.inductiveautomation.com/u/bwhite)\
**Post date:** [February 15, 2023, 6:42pm UTC](https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905/3 "2023-02-15T18:42:09Z")

</div>

I have several datasets on the chart and want to enable and disable them within a script.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 15, 2023, 6:53pm UTC](https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905/4 "2023-02-15T18:53:56Z")

</div>

[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.25/com/inductiveautomation/factorypmi/application/components/PMIChart.html#setDatasetEnabled(java.lang.String,boolean)](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.25/com/inductiveautomation/factorypmi/application/components/PMIChart.html#setDatasetEnabled(java.lang.String,boolean))

Something like:  
`event.source.setDatasetEnabled("chartDataSet1", True)`

---

<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:** [February 15, 2023, 7:03pm UTC](https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905/5 "2023-02-15T19:03:29Z")

</div>

That one is probably worth putting into the manual under "Component Functions":

[Vision Chart Component](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Chart#VisionChart-ComponentFunctions)

---

<div class="post-metadata">

**Author:** ![bwhite](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bwhite/32/7112_2.png) [@bwhite](https://forum.inductiveautomation.com/u/bwhite)\
**Post date:** [February 15, 2023, 7:56pm UTC](https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905/6 "2023-02-15T19:56:14Z")

</div>

Thank you! I have a related item. I have a power table and I want to change the attributes on a script. I have this working:

if colName == 'percentage':  
if value \< 90.0:  
attributes["background"] = "#ea0000"

But I want to also change the suffix to a %. I tried attributes["suffix"] = '%', but that didn't work.

---

<div class="post-metadata">

**Author:** ![bwhite](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bwhite/32/7112_2.png) [@bwhite](https://forum.inductiveautomation.com/u/bwhite)\
**Post date:** [February 15, 2023, 9:15pm UTC](https://forum.inductiveautomation.com/t/vision-classic-chart-change-dataset-properties-in-scripting/69905/7 "2023-02-15T21:15:58Z")

</div>

I've also tried this on the configureHeaderStyle scripting:

if bool:  
return {'label': "on count"}  
else:  
return{'label': "off count"}
