I search through the site, but did not find anything on this. Hopefully this is not redundant, but I can't imagine that I'm the first to look for this.
I'd like to save a trend object as an image to be used in other applications.
In the PI ProcessBook VBA language reference check out the SaveAs method in the Displays method. It takes two arguments: the name and format. JPEG is one of the accepted formats:
I see how I could use this to save the entire display as an image, but is there a way to save individual trends within my display. I tried specifying the trend in this method, but it was not supported.
I will have 10s of trends in a single display that I would like to save as individual images.
How about maximizing the trend and save it:
Dim mySymbol As Symbol
Dim i As Integer
i = 0
For Each mySymbol In ThisDisplay.Symbols
If mySymbol.Type = pbSymbolTrend Then
Dim myTrend As Trend
Set myTrend = mySymbol
Call ThisDisplay.SaveAs("test" & i, pbpdFormatJPEG)
i = i + 1
Ideally, I'd like to be able to size the trend exactly as I want the image to be saved. But if there are not other options, I can likely make this work.
you can resize the display to achieve this:
ThisDisplay.Height = 480
ThisDisplay.Width = 640
This works great, with one exception. Hopefully you can guide me through this as well.
When the trend is not maximized it displays as below:
When maximized, it inserts the trace name even though I have that option turned off in the trend display format. All legend items are unchecked.
Mmh - AFAIk there is no way to change this. That would be an enhancement request to be send to techsupport.
Retrieving data ...