Hello, I want to overlay event data on a timeseries chart. Meaning, I want a timeseries chart that has historical tag data on it. Then, I also want events that happened during that time period on the chart with a "marker" with a value on it (1-Event-N) so the operator knows what event happened when. I have the event table with a timestamp on when the event happened and the other data relative the event. I am just not sure how to add these to the chart.
Is something like this possible?
I'm assuming this is perspective?
It doesn't appear that you can put data labels on a time series chart(my forum searching skills may be poor), however the XY chart does support data labels, you might be able to customize one of those to fit your needs.
In the case of XY chart I would have your main tag data values as one series and the events as another. This would allow you to have your events as dots above/away from the main historical data but still close enough to be able to see if they might be related to values observed at around the same time.
I was able to (kind of) do what I want. I did this by manually merging the historical data and the event data in a script data source. I put the event(s) as a separate pen on the timeseries chart, and made it a bar type with the number shown on the bar.
The second page of the report states the event data for each event.
It would be nice if I could just put a big #1 diamond shape on the chart in the correct location on when the event happened..
It looks like it's the Report module - so neither Vision nor Perspective - is it?
It's in the reporting module. I am using perspective to bring up the reports.
def updateData(data, sample):
#data['myKey']='Example'
# this gets the main query data, as well as the child query data
query_data = data['DeviceInformation'].getCoreResults()
# convert this dataset to a pyDataSet
device_info = system.dataset.toPyDataSet(query_data)[0]
# gets the device id from the data query
device_id = device_info['DeviceId']
# gets the base tag path
tagPath = "[default]" + device_info['PLC'] + "/" + device_id
# gets the historical
attributes = ['Temperature', 'Level']
_paths = []
for i in attributes:
_paths.append(tagPath + "/" + i)
# gets the tag history
tag_history = system.tag.queryTagHistory(
paths=_paths,
startDate=data['StartDate'],
endDate=data['EndDate'],
aggregationMode="Average",
columnNames=attributes,
returnSize=-1,
returnFormat="Wide"
)
# convert the tag history to a pyData object
tag_history_pyData = system.dataset.toPyDataSet(tag_history)
# gets the event data, through the named query
params = {
'device_id':device_id,
'end_time':data['EndDate'],
'start_time':data['StartDate']
}
event_data = system.db.runNamedQuery("VesselEvent/Select", params)
# adds the event data to the report data
data['event_data'] = event_data
# converts the event data to a pyDataSet
event_pyData = system.dataset.toPyDataSet(event_data)
# create the return dataset
headers = ['t_stamp','Temperature','Level','Event']
return_data = []
for i in tag_history_pyData:
a_row = [i['t_stamp'], i['Temperature'], i['Level'], None]
return_data.append(a_row)
# end for
# adds the event data at the end of the list, because the chart
# object will sort it
for i in event_pyData:
a_row = [i['timestamp'], None, None, i['event_number']]
return_data.append(a_row)
# end for
data['script_data'] = system.dataset.toDataSet(headers, return_data)
You might want to try my ReportNoteChart--NoteChart but for the reporting module. Does exactly what you've asked.
(Sorry, hard to link from my phone--headed for ICC.)
Is it on the Ignition Exchange? I looked for it there but could not find it. Please send the link when you have time.
Thanks,
Chris
Third-party module, not an exchange resource.
More information here: