Vision Classic Chart - change Dataset Properties in scripting

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

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?

1 Like

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

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)

1 Like

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

Vision Chart Component

4 Likes

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.

I've also tried this on the configureHeaderStyle scripting:

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