Bind XTrace Y Values to a Table

Currently I am taking the .selectedXValue from an Easy Chart and searching through a separate table made from queryTagHistory that has the same Tag Paths, Start Date and End Date as my Easy Chart. However this has a curious quirk where not every selectedXValue matches a value in the t_stamp column. I am converting the values in t_stamp to a string so it matches the selectedXValue format (“yyyy-MM-dd HH:mm:ss”).

Am I doing this correctly or is there a better way to get the xTrace values in a table?

Thanks!

UPDATE
Figured it out- instead of querying all of the tag history and trying to search for the values at the xTrace just run a new search specifically at the selectedXValue every time your mouse leaves the the graph

tags = [“TagPath Here”]
data = system.tag.queryTagHistory(paths=tags, startDate = event.source.selectedXValue, endDate=event.source.selectedXValue)

If you don’t want the extra lookup, or want to allow some tolerance for non-exact timestamps, the NoteChart Module provides exactly the data you are looking for in the “samples” property of either the NoteChart component or the EasyNoteChart component. And the ‘traceTS’ property is an actual datetime instead of a string. (-:

The ‘yValue’ property within the ‘getXTraceLabel’ extension function will return it. Here is an example where I write it to a label component within the same window.