Promotic

onTimeChange - event of the PmgTrendViewer object

Description:
The event is triggered when begin or end time of viewer changed.
Parameters:
pMe(Object) Reference to the PmgTrendViewer object where the event rises.
pEvent(Object) Reference to the object describing detailed information about the specific event.
pEvent.Range - (String) [for reading] Type of the time axis range change
"minmax": For graphic mode. Both the left end the right time was changed.
New values are in pEvent.TimeMinNew and pEvent.TimeMaxNew properties.
"mincount": For table mode. The oldest (bottom) time has been changed.
In the pEvent.TimeMinNew property is new value.
In the pEvent.TimeMaxNew property is: null for JavaScript or Empty for VBScript.
"maxcount": For table mode. The newest (upper) time has been changed.
In the pEvent.TimeMaxNew property is new value.
In the pEvent.TimeMinNew property is: null for JavaScript or Empty for VBScript.
pEvent.ZoomChanged - (Boolean) [for reading] Flag informing that the time axis range has been modified or shifted.
The property is used only if the graphic mode is set. For table mode it is always false.
false: the time axis has been shifted
true: the time axis range has been modified
pEvent.Zoom - (Double) [for reading] (range) The real range of the time axis (TimeSpan).
This is basically the difference between pEvent.TimeMaxNew - pEvent.TimeMinNew, bat it also solves the situation when there is a shift standard time - standard time between those times.
pEvent.TimeMinNew - (Date) [for read and write] (from) Begin new time.
pEvent.TimeMinType - (Long) [for read and write] Time type in the pEvent.TimeMinNew property.
The parameter has the same values as the TimeSetType property.
pEvent.TimeMaxNew - (Date) [for read and write] (to) End new time.
pEvent.TimeMaxType - (Long) [for read and write] Time type in the pEvent.TimeMaxNew property.
The parameter has the same values as the TimeSetType property.
Note:
This event is also functional in Web panels. Writing into pEvent.TimeMin.. and pEvent.TimeMax.. properties is not functional.

Each change in setting the time of the left or right viewer border (e.g. by calling the methods ScrollTime and ZoomTime, the autoscroll tick or by moving the time axis by an user - dragging the mouse) automatically calls the request for the data by tvTrend objects and the onReadData event is triggered.

During triggering this event the request for the data from the tvTrend objects hasn't been sent yet (if they are connected to a server) and also the onReadData event is not triggered yet. The pEvent.TimeMinNew and pEvent.TimeMaxNew properties can be changed in this event and thus the behavior of the viewer can be influenced.
The original time can still be read from the TimeMin and TimeMax properties before moving the time axis in the script of this event.

This event is triggered also while the trend viewer is being initialized during panel opening.
Example:
JavaScriptVBScriptSelect and copy to clipboard

if (pEvent.ZoomChanged)
{
var tZoom = pEvent.Zoom;
var sZoom = Pm.FormatDate(tZoom, "%H:%M:%S");   // time range < 1 day
}

History:
Pm9.00.00: New pEvent.Zoom property.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.