Scroll to navigation

cdk_graph(3) Library Functions Manual cdk_graph(3)

NAME

cdk_graph - curses graph widget

SYNOPSIS

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

#include <cdk.h>

void activateCDKGraph (
CDKGRAPH *graph,
chtype *unused);
    
void destroyCDKGraph (
CDKGRAPH *graph);
    
void drawCDKGraph (
CDKGRAPH *graph,
boolean box);
    
void eraseCDKGraph (
CDKGRAPH *graph);
    
boolean getCDKGraphBox (
CDKGRAPH *graph);
    
chtype getCDKGraphCharacter (
CDKGRAPH *graph,
int index);
    
chtype *getCDKGraphCharacters (
CDKGRAPH *graph);
    
EGraphDisplayType getCDKGraphDisplayType (
CDKGRAPH *graph);
    
int getCDKGraphValue (
CDKGRAPH *graph,
int index);
    
int *getCDKGraphValues (
CDKGRAPH *graph,
int *size);
    
void moveCDKGraph (
CDKGRAPH *graph,
int xpos,
int ypos,
boolean relative,
boolean refresh);
    
CDKGRAPH *newCDKGraph (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int height,
int width,
const char *title,
const char *xtitle,
const char *ytitle);
    
void positionCDKGraph (
CDKGRAPH *graph);
    
int setCDKGraph (
CDKGRAPH *graph,
int *values,
int valueCount,
const char *graphCharacters,
boolean startAtZero,
EGraphDisplayType displayType);
    
void setCDKGraphBackgroundAttrib (
CDKGRAPH *graph,
chtype attribute);
    
void setCDKGraphBackgroundColor (
CDKGRAPH *graph,
const char * color);
    
void setCDKGraphBox (
CDKGRAPH *graph,
boolean box);
    
void setCDKGraphBoxAttribute (
CDKGRAPH *graph,
chtype character);
    
int setCDKGraphCharacter (
CDKGRAPH *graph,
int index,
const char *graphCharacter);
    
int setCDKGraphCharacters (
CDKGRAPH *graph,
const char *graphCharacters);
    
void setCDKGraphDisplayType (
CDKGRAPH *graph,
EGraphDisplayType type);
    
void setCDKGraphHorizontalChar (
CDKGRAPH *graph,
chtype character);
    
void setCDKGraphLLChar (
CDKGRAPH *graph,
chtype character);
    
void setCDKGraphLRChar (
CDKGRAPH *graph,
chtype character);
    
void setCDKGraphULChar (
CDKGRAPH *graph,
chtype character);
    
void setCDKGraphURChar (
CDKGRAPH *graph,
chtype character);
    
int setCDKGraphValue (
CDKGRAPH *graph,
int index,
int value,
boolean startAtZero);
    
int setCDKGraphValues (
CDKGRAPH *graph,
int *values,
int valueCount,
boolean startAtZero);
    
void setCDKGraphVerticalChar (
CDKGRAPH *graph,
chtype character);
    

DESCRIPTION

The Cdk graph widget creates a graph in either X/Y plot or line mode. The following functions create or manipulate the Cdk graph box widget.

AVAILABLE FUNCTIONS

activateCDKGraph
this is an obsolete function that calls drawCDKGraph.
destroyCDKGraph
removes the widget from the screen and frees memory the object used.
drawCDKGraph
draws the graph widget on the screen. The box option tells whether to draw the widget with a box.
eraseCDKGraph
removes the widget from the screen. This does NOT destroy the widget.
getCDKGraphBox
returns true if the widget will be drawn with a box around it.
getCDKGraphCharacter
returns the character in the graph at the given index.
getCDKGraphCharacters
returns all the characters currently in the graph widget.
getCDKGraphDisplayType
returns the current display type of the widget.
getCDKGraphValue
returns the value in the graph at the given index.
getCDKGraphValues
returns all the values currently in the graph widget.
moveCDKGraph
moves the given widget to the given position.
  • The parameters xpos and ypos are the new position of the widget. The parameter xpos may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER. The parameter ypos may be an integer or one of the pre-defined values 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 TOP, BOTTOM, LEFT, RIGHT, or CENTER when relative = TRUE. (weird things may happen).
The final parameter refresh is a boolean value which states whether the widget will get refreshed after the move.
newCDKGraph
creates a pointer to a graph widget. Parameters:
screen
is the screen you wish this widget to be placed in.
xpos
controls the placement of the object along the horizontal axis. It may be an integer or one of the pre-defined values LEFT, RIGHT, and CENTER.
ypos
controls the placement of the object along the vertical axis. It may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER.
height and
width
control the height and width of the widget. If you provide a 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.
title,
xtitle and
ytitle
are the graph title, the X axis title, and the Y axis title respectively. The graph title may be more than one line by providing a carriage return character at the line break.
If the widget could not be created then a NULL pointer is returned.
positionCDKGraph
allows the user to move the widget around the screen via the cursor/keypad keys. See cdk_position (3) for key bindings.
setCDKGraph
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 may be vPLOT, to make the graph draw the values as a plot graph, or vLINE to draw the values as a line graph.
setCDKGraphBackgroundAttrib
sets the background attribute of the widget. The parameter attribute is a curses attribute, e.g., A_BOLD.
setCDKGraphBackgroundColor
sets the background color of the widget. The parameter color is in the format of the Cdk format strings. See cdk_display (3).
setCDKGraphBox
sets whether the widget will be drawn with a box around it.
setCDKGraphBoxAttribute
function sets the attribute of the box.
setCDKGraphCharacter
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.
setCDKGraphCharacters
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.
setCDKGraphDisplayType
allows the programmer tochange the way the graph draws itself. The parameter displayType may be vPLOT, to make the graph draw the values as a plot graph, or vLINE to draw the values as a line graph.
setCDKGraphHorizontalChar
sets the horizontal drawing character for the box to the given character.
setCDKGraphLLChar
sets the lower left hand corner of the widget's box to the given character.
setCDKGraphLRChar
sets the lower right hand corner of the widget's box to the given character.
setCDKGraphULChar
sets the upper left hand corner of the widget's box to the given character.
setCDKGraphURChar
sets the upper right hand corner of the widget's box to the given character.
setCDKGraphValue
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.
setCDKGraphValues
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 startAtZero states whether you want the graph to start at zero or the lowest values of the X and Y axis'.
setCDKGraphVerticalChar
sets the vertical drawing character for the box to the given character.

SEE ALSO

cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)