cdk_graph(3)

NAME
newCDKGraph, setCDKGraph, setCDKGraphValues, getCDKGraphValues, setCDKGraphValue, getCDKGraphValue, setCDKGraphValues, getCDKGraphValues, setCDKGraphCharacters, getCDKGraphCharacters, setCDKGraphCharacter, getCDKGraphCharacter, setCDKGraphDisplayType, getCDKGraphDisplayType, setCDKGraphBox, getCDKGraphBox, setCDKGraphULChar, setCDKGraphURChar, setCDKGraphLLChar, setCDKGraphLRChar, setCDKGraphVerticalChar, setCDKGraphHorizontalChar, setCDKGraphBoxAttribute, setCDKGraphBackgroundColor, drawCDKGraph, eraseCDKGraph, destroyCDKGraph - Creates a managed curses graph widget.

SYNOPSIS

cc [ flag ... ] file ... -lcdk [ library ... ]

#include <cdk.h>

CDKGRAPH *newCDKGraph (CDKSCREEN *cdkscreen, int xpos, int ypos, int height, int width, char *title, char *xtitle, char *ytitle);

void setCDKGraph (CDKGRAPH *graph, int *values, int valueCount, char *graphCharacters, boolean startAtZero, EGraphDisplayType displayType);

void setCDKGraphValues (CDKGRAPH *graph, int *values, int valueCount, boolean startAtZero);

int *getCDKGraphValues (CDKGRAPH *graph);

void setCDKGraphValue (CDKGRAPH *graph, int index, int value, boolean startAtZero);

int getCDKGraphValue (CDKGRAPH *graph, int index);

void setCDKGraphCharacters (CDKGRAPH *graph, char *graphCharacters);

char *getCDKGraphCharacters (CDKGRAPH *graph);

void setCDKGraphCharacter (CDKGRAPH *graph, int index, char *graphCharacter);

char *getCDKGraphCharacter (CDKGRAPH *graph, int index);

void setCDKGraphDisplayType (CDKGRAPH *graph, EGraphDisplayType type);

EGraphDIsplayType setCDKGraphDisplayType (CDKGRAPH *graph);

void setCDKGraphBox (CDKGRAPH *graph, boolean box);

boolean setCDKGraphBox (CDKGRAPH *graph);

void setCDKGraphULChar (CDKGRAPH *,graph, chtype character);

void setCDKGraphURChar (CDKGRAPH *,graph, chtype character);

void setCDKGraphLLChar (CDKGRAPH *,graph, chtype character);

void setCDKGraphLRChar (CDKGRAPH *,graph, chtype character);

void setCDKGraphVerticalChar (CDKGRAPH *,graph, chtype character);

void setCDKGraphHorizontalChar (CDKGRAPH *,graph, chtype character);

void setCDKGraphBoxAttribute (CDKGRAPH *,graph, chtype character);

void setCDKGraphBackgroundColor (CDKGRAPH *,graph, char * color);

void moveCDKGraph (CDKGRAPH *graph, int box, int box, boolean relative, boolean refresh);

void positionCDKGraph (CDKGRAPH *graph);

void drawCDKGraph (CDKGRAPH *graph, boolean box);

void eraseCDKGraph (CDKGRAPH *graph);

void destroyCDKGraph (CDKGRAPH *graph);

DESCRIPTION
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.
void setCDKGraphCharacters (CDKGRAPH *graph, char *characters);
    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.
void setCDKGraphDisplayType (CDKGRAPH *graph, EGraphDisplayType type);
    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.
EGraphDisplayType getCDKGraphDisplayType (CDKGRAPH *graph);
    This returns the current display type of the widget.
void setCDKGraphBox (CDKGRAPH *graph, boolean boxWidget);
    This sets whether or not the widget will be draw with a box around it.

boolean getCDKGraphBox (CDKGRAPH *graph);
    This returns whether or not the widget will be drawn with a box around it.
void setCDKGraphULChar (CDKGRAPH *graph, chtype character);
    This function sets the upper left hand corner of the widgets box to the given character.
void setCDKGraphURChar (CDKGRAPH *graph, chtype character);
    This function sets the upper right hand corner of the widgets box to the given character.
void setCDKGraphLLChar (CDKGRAPH *graph, chtype character);
    This function sets the lower left hand corner of the widgets box to the given character.
void setCDKGraphLRChar (CDKGRAPH *graph, chtype character);
    This function sets the lower right hand corner of the widgets box to the given character.
void setCDKGraphVerticalChar (CDKGRAPH *graph, chtype character);
    This function sets the vertical drawing character for the box to the given character.
void setCDKGraphHorizontalChar (CDKGRAPH *graph, chtype character);
    This function sets the horizontal drawing character for the box to the given character.
void setCDKGraphBoxAttribute (CDKGRAPH *graph, chtype attribute);
    This function sets the attribute of the box.
void setCDKGraphBackgroundColor (CDKGRAPH *graph, char *color);
    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.

SEE ALSO
cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3)

NOTES

The header file <cdk.h> automatically includes the header files <curses.h>, <stdlib.h>, <string.h>, <ctype.h>, <unistd.h>, <dirent.h>, <time.h>, <errno.h>, <pwd.h>, <grp.h>, <sys/stat.h>, and <sys/types.h>. The <curses.h> header file includes <stdio.h> and <unctrl.h>.

If you have Ncurses installed on your machine add -DNCURSES to the compile line to include the Ncurses header files instead.