version 2.8
Graph

Detailed Description

Graph window. Used to display highly customizable graphs.

GWIN allows it to easily draw graphs.

Precondition
GFX_USE_GWIN must be set to TRUE in your gfxconf.h
GWIN_NEED_GRAPH must be set to TRUE in your gfxconf.h

Functions

GHandle gwinGGraphCreate (GDisplay *g, GGraphObject *gg, const GWindowInit *pInit)
 Create a graph window. More...
 
void gwinGraphSetStyle (GHandle gh, const GGraphStyle *pstyle)
 Set the style of the graphing operations. More...
 
void gwinGraphSetOrigin (GHandle gh, coord_t x, coord_t y)
 Set the origin for graphing operations. More...
 
void gwinGraphDrawAxis (GHandle gh)
 Draw the axis and the background grid. More...
 
void gwinGraphStartSet (GHandle gh)
 Start a new set of graphing data. More...
 
void gwinGraphDrawPoint (GHandle gh, coord_t x, coord_t y)
 Draw a graph point. More...
 
void gwinGraphDrawPoints (GHandle gh, const point *points, unsigned count)
 Draw multiple graph points. More...
 

Function Documentation

GHandle gwinGGraphCreate ( GDisplay *  g,
GGraphObject *  gg,
const GWindowInit pInit 
)

Create a graph window.

Returns
NULL if there is no resultant drawing area, otherwise a window handle.
Parameters
[in]gThe GDisplay to display this window on
[in]ggThe GGraphObject structure to initialise. If this is NULL the structure is dynamically allocated.
[in]pInitThe initialization parameters to use
Note
The drawing color and the background color get set to the current defaults. If you haven't called gwinSetDefaultColor() or gwinSetDefaultBgColor() then these are White and Black respectively.
The font gets set to the current default font. If you haven't called gwinSetDefaultFont() then there is no default font and text drawing operations will no nothing.
The dimensions and position may be changed to fit on the real screen.
A graph does not save the drawing state. It is not automatically redrawn if the window is moved or its visibility state is changed.
The coordinate system within the window for graphing operations (but not for any other drawing operation) is relative to the bottom left corner and then shifted right and up by the specified graphing x and y origin. Note that this system is inverted in the y direction relative to the display. This gives the best graphing arrangement ie. increasing y values are closer to the top of the display.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinGraphDrawAxis ( GHandle  gh)

Draw the axis and the background grid.

Parameters
[in]ghThe window handle (must be a graph window)
Note
The graph is not automatically cleared. You must do that first by calling gwinClear().
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinGraphDrawPoint ( GHandle  gh,
coord_t  x,
coord_t  y 
)

Draw a graph point.

A graph point and a line connecting to the previous point will be drawn.

Parameters
[in]ghThe window handle (must be a graph window)
[in]x,yThe new point for the graph.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinGraphDrawPoints ( GHandle  gh,
const point points,
unsigned  count 
)

Draw multiple graph points.

A graph point and a line connecting to each previous point will be drawn.

Parameters
[in]ghThe window handle (must be a graph window)
[in]pointsThe array of points for the graph.
[in]countThe number of points in the array.
Note
This is slightly more efficient than calling gwinGraphDrawPoint() repeatedly.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinGraphSetOrigin ( GHandle  gh,
coord_t  x,
coord_t  y 
)

Set the origin for graphing operations.

Parameters
[in]ghThe window handle (must be a graph window)
[in]x,yThe new origin for the graph (in graph coordinates relative to the bottom left corner).
Note
The graph is not automatically redrawn. The new origin will apply to any new drawing operations.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinGraphSetStyle ( GHandle  gh,
const GGraphStyle *  pstyle 
)

Set the style of the graphing operations.

Parameters
[in]ghThe window handle (must be a graph window)
[in]pstyleThe graph style to set.
Note
The graph is not automatically redrawn. The new style will apply to any new drawing operations.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinGraphStartSet ( GHandle  gh)

Start a new set of graphing data.

This prevents a line being drawn from the last data point to the next point to be drawn.

Parameters
[in]ghThe window handle (must be a graph window)
Function Class:
Normal API, this function can be invoked by regular system threads.