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.
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.
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.
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:
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
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'
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
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.