Easy Chart exportExcel rename headers?

One approach that I've used for this involves getting the data from the chart indirectly, and then, changing the header names before using system.dataset.exportExcel/CSV to save the file. Here is an example that has been adapted for this use case:

# Get the easyChart component
easyChart = event.source.parent.getComponent('ChartContainer').getComponent('Easy Chart')

# This function extracts the row data from the supplied dataset.
# ...Then, it creates a new dataset using the provided headers
def renameHeaders(dataset, headers):
	values = [[dataset.getValueAt(row,col) for col in range(dataset.columnCount)] for row in range(dataset.rowCount)]
	return system.dataset.toDataSet(headers,values)

# Get the tag paths column as a java list
tagPaths = list(easyChart.tagPens.getColumnAsList(easyChart.tagPens.getColumnIndex('TAG_PATH')))

# Create a list with the desired header names
headers = ['Time Stamp', 'jobpress']

# Get the displayed start date and end date from the chart
startTime = easyChart.zoomedStartDate
endTime = easyChart.zoomedEndDate

# Get the easy chart's dataset indirectly with a tag history query using the easy chart's parameters
tagHistory = system.tag.queryTagHistory(paths=tagPaths, startDate=startTime, endDate=endTime, returnSize=-1, aggregationMode="Maximum", returnFormat='Wide', noInterpolation=True)

# Use the renameHeaders function to replace the headers that were returned by the tag history query
dataset = renameHeaders(tagHistory, headers)

# Create an xls file using the modified dataset
system.dataset.exportExcel('myFileName.xls', True, dataset)

Result:
image

Edit:
@bschroeder posted his reply while I was putting mine together, so I didn't notice it. I tested the exportDatasets he listed and was pleased to see that it also returns only the displayed [zoomed] values. Here is the above example adapted to use that method:

# Get the easyChart component
easyChart = event.source.parent.getComponent('ChartContainer').getComponent('Easy Chart')

# This function extracts the row data from the supplied dataset.
# ...Then, it creates a new dataset using the provided headers
def renameHeaders(dataset, headers):
	values = [[dataset.getValueAt(row,col) for col in range(dataset.columnCount)] for row in range(dataset.rowCount)]
	return system.dataset.toDataSet(headers,values)

# Get the tag paths column as a java list
tagPaths = list(easyChart.tagPens.getColumnAsList(easyChart.tagPens.getColumnIndex('TAG_PATH')))

# Create a list with the desired header names
headers = ['Time Stamp', 'jobpress']

# Use the renameHeaders function in conjunction with exportDatasets
# ...to produce a dataset with the desired header names
dataset = renameHeaders(easyChart.exportDatasets()[0], headers)

# Create an xls file using the modified dataset
system.dataset.exportExcel('myFileName.xls', True, dataset)