# Chart Dataset Enabled Property

**URL:** <https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [April 23, 2012, 9:41pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339 "2012-04-23T21:41:27Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![techerdone](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@techerdone](https://forum.inductiveautomation.com/u/techerdone)\
**Post date:** [April 23, 2012, 9:41pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/1 "2012-04-23T21:41:27Z")

</div>

Is there any way to access a charts dataset enable/disable property?

I am trying to have some selection buttons that will eliminate specific pens from several plots in one chart. I can't use the easy chart because I need the database to be dynamically selected.

---

<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:** [April 23, 2012, 11:45pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/2 "2012-04-23T23:45:11Z")

</div>

Yes. You can enabled/disable it using a scripting function on the chart. Here is an example:`chart = event.source.parent.getComponent('Chart')
chart.setDatasetEnabled("Data", 0)`Just replace the “Data” with the name of the dataset you want to disable.

---

<div class="post-metadata">

**Author:** ![techerdone](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@techerdone](https://forum.inductiveautomation.com/u/techerdone)\
**Post date:** [April 24, 2012, 5:18am UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/3 "2012-04-24T05:18:31Z")

</div>

Yes! Thank you.

I looked through manual for this property and could not find anything. Is there a list of properties for components that is not listed in the manual?

---

<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:** [April 24, 2012, 2:43pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/4 "2012-04-24T14:43:46Z")

</div>

This one is not documented right now but I made a note to put it in our system.

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [January 11, 2023, 6:28pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/5 "2023-01-11T18:28:53Z")

</div>

My script is not able to see a root container property to dynamically set this property.

---

<div class="post-metadata">

**Author:** ![MUNIYANDI\_D](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@MUNIYANDI\_D](https://forum.inductiveautomation.com/u/MUNIYANDI_D)\
**Post date:** [February 5, 2025, 6:35am UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/6 "2025-02-05T06:35:19Z")

</div>

Hi Mr. @Travis.Cox ,

Is there any way to enable/disable the datasets in the chart for ignition vision?

I had tried this way, but I got an error while triggering that condition. I had 4 datasets in that chart and I want to disable any one of these datasets in the chart.

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

Script:

```python
	chart = event.source.parent.parent.getComponent('Chart').chart
	if event.source.selected:
		chart.setDatasetEnabled("Data", 0)
		chart.setDatasetEnabled("lines", 1)
		chart.setDatasetEnabled("shapes", 1)
	    
	else:
		chart.plot.rangeAxis.setAutoRange(True)
		chart.setDatasetEnabled("Data", 1)
		chart.setDatasetEnabled("lines", 0)
		chart.setDatasetEnabled("shapes", 0)

```

I put that script in the property change script in Checkbox. When I enable the Checkbow, required datasets should be enabled,d and other datasets should be disabled.

Error:

```python
Traceback (most recent call last):
  File "<event:propertyChange>", line 9, in <module>
  File "<custom-function Range_Assigning>", line 10, in Range_Assigning
AttributeError: 'org.jfree.chart.JFreeChart' object has no attribute 'setDatasetEnabled'

Ignition v8.1.44 (b2024102210)
Java: Azul Systems, Inc. 17.0.12

```

Thanks,  
Muniyandi D

---

<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 5, 2025, 12:47pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/7 "2025-02-05T12:47:50Z")

</div>

You have an extra `.chart` at the end of your script's first line. Take that off for the `.setDatasetEnabled()` method to work.

---

<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:** [February 5, 2025, 9:44pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/8 "2025-02-05T21:44:33Z")

</div>

Correct but you will need the .chart on this line:

chart.chart.plot.rangeAxis.setAutoRange(True)

---

<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 5, 2025, 9:53pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/9 "2025-02-05T21:53:40Z")

</div>

For posterity, the function Travis originally mentioned (and a bunch of other utilities) are documented on this page:

> **[Vision - Chart Scripting Functions | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/components/vision-components/charts/chart/chart-scripting-functions#setdatasetenabled)**
>
> This page details the various component and extension functions available for Vision's Chart component.

---

<div class="post-metadata">

**Author:** ![MUNIYANDI\_D](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@MUNIYANDI\_D](https://forum.inductiveautomation.com/u/MUNIYANDI_D)\
**Post date:** [February 6, 2025, 5:48am UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/10 "2025-02-06T05:48:46Z")

</div>

Hi @pturmel, thank you for your suggestion. But I got an error after doing that regarding the suggestion you gave.

Script:

```python
	chart = event.source.parent.parent.getComponent('Chart')
	if event.source.selected:
		chart.setDatasetEnabled("Data", 0)
		chart.setDatasetEnabled("lines", 1)
		chart.setDatasetEnabled("shapes", 1)
	    
	else:
		chart.plot.rangeAxis.setAutoRange(True)
		chart.setDatasetEnabled("Data", 1)
		chart.setDatasetEnabled("lines", 0)
		chart.setDatasetEnabled("shapes", 0)

```

Error:

```python
Traceback (most recent call last):
  File "<event:propertyChange>", line 9, in <module>
  File "<custom-function Range_Assigning>", line 10, in Range_Assigning
AttributeError: 'org.jfree.chart.JFreeChart' object has no attribute 'setDatasetEnabled'

```

Thanks,  
Muniyandi D

---

<div class="post-metadata">

**Author:** ![andrew.budaiev](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrew.budaiev/32/72921_2.png) [@andrew.budaiev](https://forum.inductiveautomation.com/u/andrew.budaiev)\
**Post date:** [February 6, 2025, 5:53am UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/11 "2025-02-06T05:53:03Z")

</div>

> [@MUNIYANDI\_D](#):
>
> ```python
> chart.setDatasetEnabled()("Data", 0)
> 
> ```

You have extra parentheses here.

---

<div class="post-metadata">

**Author:** ![MUNIYANDI\_D](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@MUNIYANDI\_D](https://forum.inductiveautomation.com/u/MUNIYANDI_D)\
**Post date:** [February 6, 2025, 6:43am UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/12 "2025-02-06T06:43:58Z")

</div>

Sorry, i mistakenly gives extra parentheses. Now, i had corrected @andrew.budaiev .

Script:

```python
	chart = event.source.parent.parent.getComponent('Chart').chart
	if event.source.selected:
		chart.setDatasetEnabled("Data", 0)
		chart.setDatasetEnabled("lines", 1)
		chart.setDatasetEnabled("shapes", 1)
	    
	else:
		chart.plot.rangeAxis.setAutoRange(True)
		chart.setDatasetEnabled("Data", 1)
		chart.setDatasetEnabled("lines", 0)
		chart.setDatasetEnabled("shapes", 0)

```

But,, i got that same error again.

Error:

```python
Traceback (most recent call last):
  File "<event:propertyChange>", line 1, in <module>
  File "<custom-function Range_Assigning>", line 10, in Range_Assigning
AttributeError: 'org.jfree.chart.JFreeChart' object has no attribute 'setDatasetEnabled'

Ignition v8.1.44 (b2024102210)
Java: Azul Systems, Inc. 17.0.12

```

---

<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 6, 2025, 1:01pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/13 "2025-02-06T13:01:33Z")

</div>

You put the `.chart` back on the end of the first line. Take it off.

---

<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 6, 2025, 4:05pm UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/14 "2025-02-06T16:05:21Z")

</div>

> `event.source.parent.parent.getComponent('Chart')`

This gives you a reference to the **Ignition** chart component. That's what has the `setDatasetEnabled` method.

> `event.source.parent.parent.getComponent('Chart').chart`

This gives you a reference to the underlying **Jfreechart** component. This has a variety of methods for changing rendering of the actual graphical chart, but does _not_ have the `setDatasetEnabled` method you're trying to use.

---

<div class="post-metadata">

**Author:** ![MUNIYANDI\_D](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@MUNIYANDI\_D](https://forum.inductiveautomation.com/u/MUNIYANDI_D)\
**Post date:** [February 7, 2025, 5:42am UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/15 "2025-02-07T05:42:53Z")

</div>

Thank you, Mr. @pturmel for your suggestion. Finally, I got what I expected.

Thanks,  
Muniyandi D

---

<div class="post-metadata">

**Author:** ![MUNIYANDI\_D](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@MUNIYANDI\_D](https://forum.inductiveautomation.com/u/MUNIYANDI_D)\
**Post date:** [February 7, 2025, 5:44am UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/16 "2025-02-07T05:44:02Z")

</div>

I understood Mr. @paul-griffith , Thanks for your suggestion.

Thanks,  
Muniyandi D

---

<div class="post-metadata">

**Author:** ![ltoscano](https://avatars.discourse-cdn.com/v4/letter/l/3be4f8/32.png) [@ltoscano](https://forum.inductiveautomation.com/u/ltoscano)\
**Post date:** [November 5, 2025, 12:32am UTC](https://forum.inductiveautomation.com/t/chart-dataset-enabled-property/4339/17 "2025-11-05T00:32:28Z")

</div>

Hello All - Same idea but I want to disable the component altogether. If my history source goes away the chart keeps throwing up errors regardless of whether I disable the dataset or not. Any thoughts?
