Admin Production ni-theme
Current Publication

PlotPolygon

LabWindows/CVI

PlotPolygon

int PlotPolygon (int panelHandle, int controlID, void *xArray, void *yArray, size_t pointsInPolygon, int xDataType, int yDataType, int color, int fillColor);

Purpose

Plots a polygon onto a graph control.

Define the polygon by a set of connected x-y points. The last point is automatically connected to the first point to close the polygon.

Supported Controls

You can use PlotPolygon with graph controls.

Parameters

Input
Name Type Description
panelHandle int Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel.
controlID int The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by functions such as NewCtrl and DuplicateCtrl.
xArray void * Array that contains the values to plot along the x-axis. The data type must be of the type you specify in xDataType.
yArray void * Array that contains the values to plot along the y-axis. The data type must be of the type specified by yDataType.
pointsInPolygon size_t Number of connected points, or corners, in the polygon. At least three corners must exist. pointsInPolygon controls the number of corners plotted, even if the number of elements in the x and y arrays is greater than the value of pointsInPolygon.
xDataType int The data type of the x array. The following table lists the valid data types.

VAL_CHAR A single byte character.
VAL_SHORT_INTEGER A 2 byte integer.
VAL_INTEGER A 4 byte integer.
VAL_FLOAT A 4 byte floating point value.
VAL_DOUBLE An 8 byte floating point value.
VAL_64BIT_INTEGER An 8 byte integer.
VAL_UNSIGNED_SHORT_INTEGER An unsigned 2 byte integer.
VAL_UNSIGNED_INTEGER An unsigned 4 byte integer.
VAL_UNSIGNED_CHAR An unsigned single byte character.
VAL_UNSIGNED_64BIT_INTEGER An unsigned 8 byte integer.
VAL_SIZE_T An unsigned 4 byte integer (32-bit applications).
An unsigned 8 byte integer (64-bit applications).
VAL_SSIZE_T A 4 byte integer (32-bit applications).
An 8 byte integer (64-bit applications).
VAL_PTRDIFF_T A 4 byte integer (32-bit applications).
An 8 byte integer (64-bit applications).
VAL_UINTPTR_T An unsigned 4 byte integer (32-bit applications).
An unsigned 8 byte integer (64-bit applications).
VAL_INTPTR_T A 4 byte integer (32-bit applications).
An 8 byte integer (64-bit applications).
yDataType int The data type of the y array. The following table lists the valid data types.

VAL_CHAR A single byte character.
VAL_SHORT_INTEGER A 2 byte integer.
VAL_INTEGER A 4 byte integer.
VAL_FLOAT A 4 byte floating point value.
VAL_DOUBLE An 8 byte floating point value.
VAL_64BIT_INTEGER An 8 byte integer.
VAL_UNSIGNED_SHORT_INTEGER An unsigned 2 byte integer.
VAL_UNSIGNED_INTEGER An unsigned 4 byte integer.
VAL_UNSIGNED_CHAR An unsigned single byte character.
VAL_UNSIGNED_64BIT_INTEGER An unsigned 8 byte integer.
VAL_SIZE_T An unsigned 4 byte integer (32-bit applications).
An unsigned 8 byte integer (64-bit applications).
VAL_SSIZE_T A 4 byte integer (32-bit applications).
An 8 byte integer (64-bit applications).
VAL_PTRDIFF_T A 4 byte integer (32-bit applications).
An 8 byte integer (64-bit applications).
VAL_UINTPTR_T An unsigned 4 byte integer (32-bit applications).
An unsigned 8 byte integer (64-bit applications).
VAL_INTPTR_T A 4 byte integer (32-bit applications).
An 8 byte integer (64-bit applications).
color int Specifies the color of the data to plot.

An RGB value is a 4-byte integer with the hexadecimal format 0x00RRGGBB. RR, GG, and BB are the respective red, green, and blue components of the color value. The first sixteen colors in the table are the sixteen standard colors.

Value Code
VAL_RED 0xFF0000L
VAL_GREEN 0x00FF00L
VAL_BLUE 0x0000FFL
VAL_CYAN 0x00FFFFL
VAL_MAGENTA 0xFF00FFL
VAL_YELLOW 0xFFFF00L
VAL_DK_RED 0x800000L
VAL_DK_BLUE 0x000080L
VAL_DK_GREEN 0x008000L
VAL_DK_CYAN 0x008080L
VAL_DK_MAGENTA 0x800080L
VAL_DK_YELLOW 0x808000L
VAL_LT_GRAY 0xC0C0C0L
VAL_DK_GRAY 0x808080L
VAL_BLACK 0x000000L
VAL_WHITE 0xFFFFFFL
VAL_PANEL_GRAY 0xC0C0C0L
VAL_GRAY 0xA0A0A0L
VAL_OFFWHITE 0xE0E0E0L
VAL_TRANSPARENT 0x1000000L

You also can use the User Interface Library function, MakeColor, to create an RGB value from red, green, and blue color components.

To enter user-defined color values, select Options»Toggle Control Style in the function panel and manually enter the color value.
fillColor int The fill color of the figure.

An RGB value is a 4-byte integer with the hexadecimal format 0x00RRGGBB. RR, GG, and BB are the respective red, green, and blue components of the color value. The first sixteen colors in the table are the sixteen standard colors.

Value Code
VAL_RED 0xFF0000L
VAL_GREEN 0x00FF00L
VAL_BLUE 0x0000FFL
VAL_CYAN 0x00FFFFL
VAL_MAGENTA 0xFF00FFL
VAL_YELLOW 0xFFFF00L
VAL_DK_RED 0x800000L
VAL_DK_BLUE 0x000080L
VAL_DK_GREEN 0x008000L
VAL_DK_CYAN 0x008080L
VAL_DK_MAGENTA 0x800080L
VAL_DK_YELLOW 0x808000L
VAL_LT_GRAY 0xC0C0C0L
VAL_DK_GRAY 0x808080L
VAL_BLACK 0x000000L
VAL_WHITE 0xFFFFFFL
VAL_PANEL_GRAY 0xC0C0C0L
VAL_GRAY 0xA0A0A0L
VAL_OFFWHITE 0xE0E0E0L
VAL_TRANSPARENT 0x1000000L

You also can use the User Interface Library function, MakeColor, to create an RGB value from red, green, and blue color components.

To enter user-defined color values, select Options»Toggle Control Style in the function panel and manually enter the color value.

Return Value

Name Type Description
plotHandle int The handle of the new plot that you can use in subsequent function calls to reference the plot.

If the handle is positive, the new plot was successfully added to the graph. Negative values indicate that an error occurred.

Note  If ATTR_DATA_MODE is set to VAL_DISCARD, the function returns 0.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Examples

Refer to the following examples that use the PlotPolygon function:

  • userint\clipbord.cws

    Open example
  • userint\graphlegend.cws

    Open example