I am wondering if there is a way to programatically determine the max and min values of a trace in a ProcessBook display trend. My preference is to use VBA to do this, since I have little experience with the SDK. Currently, I have only been able to figure out how to call a value at a specific time, such as the last value of each trend. To do this I am using the Trend.GetTraceValue(index,time,status) function. I need a way to identify the extremes in the drawn time range, to optimize some auto-scale code. I figure something like this ought to exist since the standard auto-scale functionality adjusts based on the max/min values in the trend. Does anyone have any ideas if max/min functions exist? Or maybe even some ideas on how I can do this?
Some background info on what I am trying to accomplish:
I am attempting to make some custom auto-scale code for a few ProcessBook display trends. The out of the box auto-scale trims the scaling too closely to the displayed values. For the use case of these displays, minor changes aren't as important, and it needs to be "zoomed out" a bit. The end goal is to have autoscale code with additional padding above and below the traces (for a more linear look.) In my current re-size code, the scale is being determined as a function of the most recent value in the trend. This generally keeps the data in the form that we want.....exception being when the data changes by a significant amount in the time range. In such a case, the highest/lowest values aren't being displayed. I instead want to re-size the bounds of the trends as a function of the highest and lowest values currently in the trend. This will allow me to optimize the amount of padding above and below the trend, to give us our more linear look.
If max and min function don't exist, here is the idea I am toying with:
- Use Trend.GetTagName(index) to find the tag being trended
- Set the time range using Trend.StartTime and Trend.EndTime
- Use the above tag name and time periods to do a compressed data pull within ProcessBook (not sure if this is feasible)
- Run through those values each update, and determine the max/min
- Adjust my trend scales according to the extremes