Custom Properties on Charts

Is it possible to dynamically create a custom property for a chart?

I am making a very complicated chart that could need between 5 and 10 custom properties. Is there a way I could add a property using scripting?

event.source.getComponent(‘Chart’).addProperty(dataset7), or something that would function like this?

Thanks,

Mike

Sorry, there isn’t a way to add datasets to the chart through scripting. I think in your case you just need to add the max number of datasets you will ever need like 10. You can enable/disable ones that you don’t want to use like this:chart = event.source.parent.getComponent('Chart') chart.setDatasetEnabled("Data", 1)You can set it to a 0 or 1.

Cool.

That being established, is there any way to iterate through them?

while i <10
chart.data(i) = listOfDatasets(i)
i += 1

I know that the above code would would obviously fail, but is there any way we might be able to achieve the same effect?

This graph is complicated and giving me all sorts of issues.

Yeah, you have to call out the datasets by name but you can create a list of them to make it easy.chart = event.source.parent.getComponent('Chart') datasetNames = ["data1", "data2", "data3", "data4"] for name in datasetNames: chart.setDatasetEnabled(name, 1)

Is there a way to make a list of the actual dataset objects themselves?

Not really. You will have a static list of properties since you can’t make them dynamically.