pMe | (Object) Reference to the PmgTrendViewer object where the event rises. |
---|---|
pEvent | (Object) Reference to an object describing detailed information about the specific event.
pEvent.Action - (Long) [for reading] action type of the left mouse button
0: releasing the button
1: pressing the button
2: left mouse button double-click pEvent.Ctrl - (Boolean) [for reading] Indication of concurrent pressing the Ctrl key
pvent.Shift - (Boolean) [for reading] Indication of concurrent pressing the Shift key
pEvent.X - (Long) [for reading] Position of the mouse cursor (in pixels) in X-axis relative to the left upper corner of the area for drawing the trends (bordered by scales)
pEvent.Y - (Long) [for reading] Position of the mouse cursor (in pixels) in Y-axis relative to the left upper corner of the area for drawing the trends (bordered by scales)
pEvent.TimePos - (Variant) [for reading] Time value that refers to the curson position where it was clicked by the mouse.
pEvent.ValuePos - (Variant) [for reading] Value of the active trend (specified by the PmgTrendViewer.TrendActive property) that refers to the cursor position where it was clicked by the mouse.
If no trend is displayed in the viewer (the value of the PmgTrendViewer.TrendsCount property is 0), then the parameter is set to the value: null for JavaScript or Empty for VBScript. |
var oTrend = pMe.Trends(1);
if (Action == 0)
{
if (Ctrl)
{
// Removes the nearest point to the cursor position when the left mouse button is released
oTrend.Points.RemovePoints("range:all;time:near;", timePos);
}
else
{
// Adds point on the cursor position when the left mouse button is released
oTrend.Points.AddPoints(timePos, ValuePos, 0, 5);
}
}
var oTView = pMe;
var nTrend;
if (Action == 0)
{
nTrend = oTView.FindTrend(10, X, Y);
if (nTrend >= 0)
{
oTView.TrendActive = nTrend;
}
}