GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
gp_widget_graph.h File Reference

An XY graph. More...

#include <utils/gp_cbuffer.h>
#include <widgets/gp_widget_types.h>
#include <widgets/gp_widget_size_units.h>

Go to the source code of this file.

Data Structures

struct  gp_widget_graph_point
 A graph point. More...
 

Enumerations

enum  gp_widget_graph_style { GP_WIDGET_GRAPH_POINT , GP_WIDGET_GRAPH_LINE , GP_WIDGET_GRAPH_FILL , GP_WIDGET_GRAPH_STYLE_MAX }
 A graph drawing style. More...
 

Functions

void gp_widget_graph_point_add (gp_widget *self, double x, double y)
 Adds a graph point.
 
void gp_widget_graph_style_set (gp_widget *self, enum gp_widget_graph_style style)
 Sets a graph style.
 
void gp_widget_graph_yrange_set (gp_widget *self, double min_y, double max_y)
 Sets graph y range.
 
void gp_widget_graph_ymin_set (gp_widget *self, double min_y)
 Sets graph y minimum.
 
void gp_widget_graph_ymax_set (gp_widget *self, double max_y)
 Sets graph y maximum.
 
void gp_widget_graph_yrange_clear (gp_widget *self)
 Clears graph y range.
 
void gp_widget_graph_color_set (gp_widget *self, enum gp_widgets_color color)
 Sets graph color.
 

Variables

const char * gp_widget_graph_style_names [GP_WIDGET_GRAPH_STYLE_MAX]
 A graph style names.
 

Detailed Description

An XY graph.

Definition in file gp_widget_graph.h.

Enumeration Type Documentation

◆ gp_widget_graph_style

A graph drawing style.

Enumerator
GP_WIDGET_GRAPH_POINT 

Point graph

GP_WIDGET_GRAPH_LINE 

Points connected by line

GP_WIDGET_GRAPH_FILL 

Area below graph is filled

GP_WIDGET_GRAPH_STYLE_MAX 

Maximal number of styles

Definition at line 24 of file gp_widget_graph.h.

Function Documentation

◆ gp_widget_graph_color_set()

void gp_widget_graph_color_set ( gp_widget *  self,
enum gp_widgets_color  color 
)

Sets graph color.

Parameters
selfA graph widget.
colorAn color index.

◆ gp_widget_graph_point_add()

void gp_widget_graph_point_add ( gp_widget *  self,
double  x,
double  y 
)

Adds a graph point.

The graph data are stored in a circular buffer, when buffer is full the last data point is discarded before new point is added.

Parameters
selfA graph widget.
xA x coordinate of the data point.
yA y coordinate of the data point.

◆ gp_widget_graph_style_set()

void gp_widget_graph_style_set ( gp_widget *  self,
enum gp_widget_graph_style  style 
)

Sets a graph style.

Parameters
selfA graph widget.
styleA graph style.

◆ gp_widget_graph_ymax_set()

void gp_widget_graph_ymax_set ( gp_widget *  self,
double  max_y 
)

Sets graph y maximum.

If range is not set the graph is autorange mode and the data will fit the y scale.

Parameters
selfA graph widget.
max_yNew y maximum.

◆ gp_widget_graph_ymin_set()

void gp_widget_graph_ymin_set ( gp_widget *  self,
double  min_y 
)

Sets graph y minimum.

If range is not set the graph is autorange mode and the data will fit the y scale.

Parameters
selfA graph widget.
min_yNew y minimum.

◆ gp_widget_graph_yrange_clear()

void gp_widget_graph_yrange_clear ( gp_widget *  self)

Clears graph y range.

Returns graph widget into autorange mode.

Parameters
selfA graph widget.

◆ gp_widget_graph_yrange_set()

void gp_widget_graph_yrange_set ( gp_widget *  self,
double  min_y,
double  max_y 
)

Sets graph y range.

If range is not set the graph is autorange mode and the data will fit the y scale.

Parameters
selfA graph widget.
min_yNew y minimum.
max_yNew y maximum.