The Cdk graph widget creates a graph widget. This widget can draw a graph in
both plot mode and line mode. The following are functions which create or
manipulate the Cdk graph box widget.
AVAILABLE FUNCTIONS
CDKGRAPH *newCDKGraph (CDKSCREEN *screen, int xpos, int ypos, int height, int width, char *title, char *xtitle, char *ytitle);
This function creates a pointer to a graph widget. The screen parameter
is the screen you wish this widget to be placed in. The parameter xpos
controls the placement of the object along the horizontal axis. This parameter
can accept an integer value or one of the pre-defined values of LEFT,
RIGHT, and CENTER. The parameter ypos controls the placement
of the object along the vertical axis. This parameter can accept an integer
value or one of the pre-defined values of TOP, BOTTOM, and CENTER.
The parameters height and width control the height and width of the
widget. If you provide a value of zero for either of the height or the width,
the widget will be created with the full width and height of the screen. If
you provide a negative value, the widget will be created the full height or
width minus the value provided. The three parameters: title, xtitle,
and ytitle, are the graph title, the X axis title, and the Y axis title
respectively. The graph title can be more than one line; just provide a
carriage return character at the line break. If the widget could not be
created then a NULL pointer is returned.
void setCDKGraph (CDKGRAPH *graph, int *values, int valueCount, chtype *graphCharacters, boolean startAtZero, EGraphDisplayType displayType);
This function lets the programmer set the specific values of the graph widget.
The parameter values is an integer array of the values to display in the
widget; valueCount is the number of values in the array. The parameter
graphCharacters is an array of the characters to use for each graph point.
The parameter startAtZero states whether you want the graph to start at
zero or the lowest values of the X and Y axis'. The parameter displayType
accepts either vPLOT, to make the graph draw the values as a plot graph,
or vLINE to draw the values as a line graph.
void setCDKGraphValues (CDKGRAPH *graph, int *values, int valueCount, boolean startAtZero);
This function lets the programmer set the specific values of the graph widget.
The parameter values is an integer array of the values to display in the
widget; where valueCount is the number of values in the array. The
parameter startAtZero states whether you want the graph to start at
zero or the lowest values of the X and Y axis'.
char *getCDKGraphValues (CDKGRAPH *graph);
This returns all the values currently in the graph widget.
void setCDKGraphValue (CDKGRAPH *graph, int value, boolean startAtZero);
This function lets the programmer set a specific value of the graph widget.
The parameter value is the new value, while index is the
index where the new value will be stored. The parameter startAtZero
states whether you want the graph to start at zero or the lowest values of
the X and Y axis'.
char getCDKGraphValue (CDKGRAPH *graph, int index);
This returns the value in the graph at the given index.
This function lets the programmer set the specific characters of the graph widget.
The parameter characters is a char pointer array of the characters to display
in the widget.
chtype *getCDKGraphCharacters (CDKGRAPH *graph);
This returns all the characters currently in the graph widget.
void setCDKGraphCharacter (CDKGRAPH *graph, int character);
This function lets the programmer set a specific character of the graph widget.
The parameter character is the new character, while index is the
index where the new character will be stored.
chtype getCDKGraphCharacter (CDKGRAPH *graph, int index);
This returns the character in the graph at the given index.
This function allows the programmer tochange the way the graph draws itself.
The parameter displayType accepts either vPLOT, to make the graph
draw the values as a plot graph, or vLINE to draw the values as a line
graph.
This sets the background color of the widget. The parameter color
is in the format of the Cdk format strings. To get more information look
at the cdk_display manual page.
void moveCDKGraph (CDKGRAPH *graph, int xpos, int ypos, boolean relative, boolean refresh);
This function moves the given widget to the given position. The parameters
xpos and ypos is the new position of the widget. The parameter
xpos can accept an integer value or one of the pre-defined values of
TOP, BOTTOM, and CENTER. The parameter ypos can
accept an integer value or one of the pre-defined values of LEFT,
RIGHT, and CENTER. The parameter relative states whether
the xpos/ypos pair is a relative move or an absolute move. For
example if xpos = 1 and ypos = 2 and relative = TRUE,
then the widget would move one row down and two columns right. If the value
of relative was FALSE then the widget would move to the position
(1,2). Do not use the values of TOP, BOTTOM, LEFT,
RIGHT, or CENTER when relative = TRUE. (wierd things
may happen). The final parameter refresh is a boolean value which states
whether the widget will get refreshed after the move or not.
void positionCDKGraph (CDKGRAPH *graph);
This function allows the user to move the widget around the screen via the
cursor/keypad keys. The following key bindings can be used to move the
widget around the screen.
Key Bindings
Key Action
Up Arrow Moves the widget up one line.
Down Arrow Moves the widget down one line.
Left Arrow Moves the widget left one column
Right Arrow Moves the widget right one column
Keypad-1 Moves the widget down one line
and left one column.
Keypad-2 Moves the widget down one line.
Keypad-3 Moves the widget down one line
and right one column.
Keypad-4 Moves the widget left one column
Keypad-5 Centers the widget both vertically
and horizontally.
Keypad-6 Moves the widget right one column
Keypad-7 Moves the widget up one line
and left one column.
Keypad-8 Moves the widget up one line.
Keypad-9 Moves the widget up one line
and right one column.
t Moves the widget to the top of the screen.
b Moves the widget to the bottom of the screen.
l Moves the widget to the left of the screen.
r Moves the widget to the right of the screen.
c Centers the widget between the left and
right of the window.
C Centers the widget between the top and
bottom of the window.
Escape Returns the widget to it's original position.
Return Exits the function and leaves the widget
where it was.
Keypad means that if the keyboard you are using has a keypad, then the
Num-Lock light has to be on in order to use the keys as listed. (The
numeric keys at the top of the keyboard will work as well.)
void drawCDKGraph (CDKGRAPH *graph, boolean box);
This function draws the graph widget on the screen. The box option
draws the widget with or without a box.
void eraseCDKGraph (CDKGRAPH *graph);
This function removes the widget from the screen. This does NOT destroy
the widget.
void destroyCDKGraph (CDKGRAPH *graph);
This function removes the widget from the screen and frees up any memory the
object may be using.