cdk_graph(3)
π cdk_graph(3) β the Cdk graph widget, bestie edition π
okay so you opened the manual for cdk_graph (that's section 3 of the library calls, if you're keeping track π) and honestly? this widget is iconic. it draws graphs. X/Y plot mode, line mode, the whole vibe. let's get into it.
β¨ NAME β¨
cdk_graph β the Cdk graph widget. that's it, that's the name, she's simple and she knows it π
β¨ SYNOPSIS β¨
first things first, you gotta link against the library:
cc [ flag ... ] file ... -lcdk [ library ... ]
and pull in the header:
#include <cdk.h>
then here's the whole friend group of functions you get:
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);
like. that's a LOT of functions. she's high maintenance but she's worth it π«Ά
β¨ DESCRIPTION β¨
the Cdk graph widget makes a graph, and it's got two modes: X/Y plot mode or line mode. pick your fighter.
and then all the functions below? they're the ones that create or manipulate the Cdk graph box widget. that's the whole job description, bestie.
β¨ AVAILABLE FUNCTIONS β¨
activateCDKGraph
this one is obsolete π β all it does is call drawCDKGraph. so like, she's retired but she still shows up to the party.
destroyCDKGraph
removes the widget from the screen AND frees the memory the object used. this is the real goodbye, not the fake one. π
drawCDKGraph
draws the graph widget on the screen. the box option tells whether to draw the widget with a box around it. cute or not cute, your call π
eraseCDKGraph
removes the widget from the screen. but this does NOT destroy the widget β she's just off-screen, still existing, still thinking about you. it's giving ghosting but respectful.
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. three things to know, bestie, listen up:
- the parameters
xposandyposare the new position of the widget. the parameterxposmay be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER. the parameteryposmay be an integer or one of the pre-defined valuesLEFT,RIGHT, andCENTER. - the parameter
relativestates whether thexpos/ypospair 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). and by "weird things" they mean chaos. no cap.
- the final parameter
refreshis a boolean value which states whether the widget will get refreshed after the move.
newCDKGraph
creates a pointer to a graph widget. here are the parameters, one by one:
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 valuesLEFT,RIGHT, andCENTER.yposβ controls the placement of the object along the vertical axis. it may be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER.heightandwidthβ control the height and width of the widget. if you provide a zero for either of theheightor thewidth, 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. math is mathing πtitle,xtitleandytitleβ 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. multi-line title, multi-line slay.
if the widget could not be created then a NULL pointer is returned. so like, check for that. fr fr. π
positionCDKGraph
allows the user to move the widget around the screen via the cursor/keypad keys. see cdk_position (3) for key bindings. yes queen, drag her around, she loves it.
setCDKGraph
lets the programmer set the specific values of the graph widget. the deets:
- the parameter
valuesis an integer array of the values to display in the widget;valueCountis the number of values in the array. - the parameter
graphCharactersis an array of the characters to use for each graph point. - the parameter
startAtZerostates whether you want the graph to start at zero or the lowest values of the X and Y axis'. - the parameter
displayTypemay bevPLOT, to make the graph draw the values as a plot graph, orvLINEto 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. give her some drama β¨
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. (yes, "tochange" β we're keeping it, it's canon now π) 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. two bullet points, here we go:
- the parameter
valueis the new value, whileindexis the index where the new value will be stored. - the parameter
startAtZerostates 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
valuesis an integer array of the values to display in the widget. valueCountis the number of values in the array.- the parameter
startAtZerostates 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 β¨
go read these next, bestie, they're the whole extended universe:
okay that's the whole page!! π this version of the cdk_graph(3) manual is dated 2024-03-28 (that's the version/date stamp from the footer, keeping it cute and keeping it accurate π«Ά). go build a graph, you're gonna eat. periodt. ππ
π¦ where this page comes from
- debian trixie: libcdk5-dev 5.0.20250116-1 Β· BSD-4-Clause
- fedora 43: cdk 5.0.20240619-4.fc43 Β· LicenseRef-Callaway-BSD-with-advertising
- fedora 43: cdk 5.0.20240619-4.fc43 Β· LicenseRef-Callaway-BSD-with-advertising
- fedora 43: cdk 5.0.20251014-1.fc43 Β· X11-distribute-modifications-variant
- fedora 43: cdk 5.0.20251014-1.fc43 Β· X11-distribute-modifications-variant
- fedora 44: cdk 5.0.20251014-3.fc44 Β· X11-distribute-modifications-variant
- fedora 44: cdk 5.0.20251014-3.fc44 Β· X11-distribute-modifications-variant
- nixos 26.05: cdk 5.0-20260119
- nixpkgs unstable: cdk 5.0-20260119
- ubuntu questing: libcdk5-dev 5.0.20250116-1
- ubuntu resolute: libcdk5-dev 5.0.20251014-1 Β· BSD-4-Clause
- ubuntu stonking: libcdk5-dev 5.0.20260119-1 Β· BSD-4-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms