Changing Viewport Lengths via an Onscreen Button on a NA Screen
A frequently asked question concerns the process for adjusting the viewport length of a trend or line graph using an on-screen button. This functionality allows users to view different time scales without modifying the underlying code. While Sysmac Studio does not provide a built-in method for this adjustment, it can be accomplished by modifying the property through a subroutine written in Visual Basic.
Process
Step 1: Set up your Trend Graph/Broken Line Graph and buttons you wish to use to change the Viewport Length.
Step 2: Click the following button to view code for the page.
Step 3: Create a Subroutine using the following format
Sub changeTrend5
TrendGraph0.ViewportLength = 300
End Sub
Sub changeTrend24
TrendGraph0.ViewportLength = 1440
End Sub

Step 4: Setup your button to call the subroutine we just created.

Example Code
An example project is available here: