I was just wondering if there is any way to use indirection bindings on the XY Chart Datasource in perspective. Trying to create a popup for each analogue indicator. But can’t find a way to pass the tagpath to the XY Chart…
Curious if you found a solution?
I think I’m doing what you’re asking.
I have a main view and I have a view with a graph on it. I created a new parameter (under ‘PARAMS’) called ‘type’ for the graph view.
On the main view I have an object that can be clicked to pop up the graph view. The object also needs a parameter or property to pass, I’ll call it objType. You’ll need to create that property. I then added a Popup action to the onclick event of the object and selected the graph view. Under parameters, add the parameter ‘Type’ and use the “Value” drop down to select the ‘objType’ property you gave to your object.
Now when you click the object, the objects property can be passed to the graph view parameter.
My graph is an XY chart and it is displaying data from a historical tag. If you click the binding icon for the example datasource you can bind the data to an expression.
My Expression is simply
to update the chart every second
Then under the expression builder click the “Add Transform” button and select script. The script I added is
DataHtag = system.tag.queryTagHistory(paths=["[default]Average" + self.view.params.Type], returnFormat='Wide', columnNames=["t_stamp","TypeValues"],rangeMinutes=10) return DataHtag
This script pulls historical data from the database for the tag and returns it as a dataset to the ‘example’ property of the graph. My ‘Type’ parameter is set to Temp and I have a historical tag named AverageTemp.
I don’t know if you’ve figured out the XY chart or not but you’ll then need to update the series so the
series -> 0 -> data -> source property is set to example with x set to t_stamp and y set to “TypeValues”. “TypeValues” is what I defined in the script.
It’s working for me, I just don’t know how well I explained it here. If this doesn’t make any sense, let me know which part and I can upload some pictures when I get a chance.