I am trying to dynamically plot an arbitrary (call it fewer than 52) number of pens on an xy chart in a report. I am able to dynamically create and populate the necessary lists, but what is the best way to convert these lists to multiple datasets for each pen to reference?
I started off with a list of datasets, but I can’t figure out how to reference each individual dataset in the chart. Is this possible? I have the DataKey set to entryDataSet, and the Domain and pen Range Keys set to the necessary dataset column ID. The chart does not print “No Data”, so it looks like it is at least seeing something there. FWIW, i am able to obtain the correct data from the list of datasets via scripting, so I know the list of datasets are populated correctly
numOfEntriesSet = data['numOfEntries'].getCoreResults() intNumOfEntries = int(numOfEntriesSet.getValueAt(0,0)) header = ["statorSection", "BlasterID", "avgWeightLoss", "avgPercentWeightLoss", "EntryDateTime", "entryNum"] data['entryDataSet'] =  filteredData = [  for _ in range(intNumOfEntries)] rawData = data['summaryRawData'].getCoreResults() for i in range(intNumOfEntries): for row in range(rawData.rowCount): if rawData.getValueAt(row, "entryNum") == (i+1): entryList =  entryList.append(rawData.getValueAt(row, "statorSection")) entryList.append(rawData.getValueAt(row, "BlasterID")) entryList.append(rawData.getValueAt(row, "avgWeightLoss")) entryList.append(rawData.getValueAt(row, "avgPercentWeightLoss")) entryList.append(rawData.getValueAt(row, "EntryDateTime")) entryList.append(int(rawData.getValueAt(row, "entryNum"))) filteredData[i].append(entryList) data['entryDataSet'].append(system.dataset.toDataSet(header, filteredData[i]))
As far as the “dynamic” pens themselves, I am planning on going this route due to the chart scripting datasource access limitation prior to 7.9.7:
Report Module: Tag Historian Query dynamic tags list
EDIT: I was thinking about the dataset structure and how the charts reference them all wrong. what I need is to dynamically add columns for the header and dataset depending on the # of entries I have. This will be simple to print.