long AddPen (LPCTSTR DL, LPCTSTR ItemName, long ColourIndex, long SigDigits);
Available (from release):
stOCX (V2-01), stPro Automation (V2-01)
Return Value:
A handle to the newly created pen if successful otherwise 0.
Parameters:
Name: |
Description: |
DL |
The data location of the item.
Note: When connected directly to an OPCServer, the DL should be set to the same value as the ServerName argument used on the ConnectToDA or ConnectToHDA call. Tip: When adding Virtual items, specify a DL of "__VIRT__" and then use the SetPenAttribute to define the required Expression for the item. |
ItemName |
The name of the item to be added. |
ColourIndex |
Determines the pen colour. |
SigDigits |
The number of significant digits to use when displaying the pen. |
Remarks:
Call this function to add a pen to the graph. The DL and ItemName parameters uniquely identify the item to be trended. If a pen with the same DL and ItemName already exists then this will be updated.
ColourIndex associates a colour out of the colour palette with the pen.
If the ColourIndex value is outside the set of colours held by the palette, the modulus of the total number of colours in the palette is applied to give a valid value. For example, if the palette contains 10 colours and the call to AddPen had a value of 15 for ColourIndex then the value would be modified to 5 (15 % 10 = 5).
Note: If the pen already exists its colour will be changed to the new colour. A negative or zero value for this argument means the colour will be automatically assigned.
Tip: Calling AddPen will add a pen to the trend, but will not necessarily cause a plot refresh (and therefore a data fetch) to occur. This is by design as it allows multiple pens to be added to the plot simultaneously avoiding unnecessary 'flickering'. To force a data refresh the use should add a call to FetchData once all the pen adjustments have been made.