First of all I love Travis’s Vision Ad Hoc Trend chart. It is flexible and a great asset to my projects.
Has anyone figure out a way to preload pens for the Ad Hoc chart. Like set a list of tagpaths as a parameter on a button so that when launching the Ad Hoc chart window the tagpaths already exist as pens on the chart?
Or if there would be someway to have it pass a saved graph when the trend page is launched?
Though I appreciate ptrumel’s responses, I think he may have missed what I had asked here.
I am using Travis’s Vision Ad Hoc Trend chart. Which is available in the ignition exchange.
The question was how do I navigate to a windows with his Ad Hoc Trend Template, and have it load a predetermined group of pens.
After some digging I found the existing load pens function on the load graph button. My solution was create all of the desired graphs and save them publicly using the save graph button. I added a custom property on the Ad Hoc Trend template, graphID. The graphID corresponds to the database id column. I also placed a graphID property on the window and bound the template to it. This id is the passed parameter on the navigation button that opens the trend.
I then added a script on the templates property change:
if event.propertyName == "ancestor":
database = ""
info = system.db.runPrepQuery("SELECT title, tagpens, axes FROM saved_graphs WHERE id = ?", [id], database)
chart = event.source.getComponent('Easy Chart')
chart.title = info
chart.tagPens = system.dataset.fromCSV(info)
chart.axes = system.dataset.fromCSV(info)