exportDatasets() for the Easy Chart component

Interested to know how to use the return data from the exportDatasets() functions for Easy Chart. I can’t move it to table or save to files.

Besides that, I am trying to get the dataset from the Easy Chart and map it to a table but so far no luck on this. Anyone knows how?

Where or what are the exportDatasets() functions?

The Easy Chart component has 5 different properties that are datasets. Which dataset, or what dataset are you trying to move to a table? And what kind of table are you talking about? An Ignition GUI table or a database table?

Best,

exportDatasets() is a new function for Easy Chart on V7.7.3-rc1

All the 5 dataset in the easy chart components are just the configuration but not the data for the pens shown in the chart with timestamp. Wonder we can get the dataset out of Easy Chart just like the data we suppose to put into Chart component for it to show the graph.

I wanted the data to show on the Ignition GUI table because most of the end user wanted to see the data with chart. With these data, it can be used to do statistic calculation for the graph for whatever they are looking at.

I see, cool!

I checked it out. The chart.exportDatasets() method returns a list of datasets. A dataset for tag pens, a dataset for calculated pens and probably a dataset for database pens (but I didn’t set up any database pens so I don’t know for sure). It only returns a dataset for a type of pens if that type of pens exists.

So you just need to access the appropriate dataset in the list that is returned.

You are right these datasets do not hold configuration data, they hold the time series data.

Here is an example of a script on a button that gets the tag pen time series data and puts it in an Ignition table on the window:

chart = event.source.parent.getComponent('Easy Chart')
datasets = chart.exportDatasets()
event.source.parent.getComponent('Table').data = datasets[0]

Here’s an example where the tag pen time series data is printed to the console:

chart = event.source.parent.getComponent('Easy Chart')
datasets = chart.exportDatasets()
firstDataset = datasets[0]
columnNames = firstDataset.getColumnNames()
for index in xrange(firstDataset.rowCount):
	for columnName in columnNames:
		print firstDataset.getValueAt(index,columnName),
	print

Best,

THANKS!! it works like what i wanted to. The returned dataset is the time series data for each pen and it follows exactly what you have on the chart. This is a very good information for us to do statistical calculation.

Thank you once again.