GwyGraphBasics

GwyGraphBasics — Common graph functions and utilities

Synopsis




            GwyGraphDataPoint;
            GwyGraphActiveAreaSpecs;
void        gwy_graph_draw_point            (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gint x,
                                             gint y,
                                             GwyGraphPointType type,
                                             gint size,
                                             const GwyRGBA *color,
                                             gboolean clear);
void        gwy_graph_draw_line             (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gint x_from,
                                             gint y_from,
                                             gint x_to,
                                             gint y_to,
                                             GdkLineStyle line_style,
                                             gint size,
                                             const GwyRGBA *color);
void        gwy_graph_draw_curve            (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GObject *curvemodel);
void        gwy_graph_draw_selection_points (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraphPoint *selection);
void        gwy_graph_draw_selection_areas  (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraphArea *selection);
void        gwy_graph_draw_selection_lines  (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraphLine *selection,
                                             GtkOrientation orientation);
void        gwy_graph_draw_selection_xareas (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraph1DArea *selection);
void        gwy_graph_draw_selection_yareas (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraph1DArea *selection);
void        gwy_graph_draw_grid             (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GArray *x_grid_data,
                                             GArray *y_grid_data);
const GwyRGBA* gwy_graph_get_preset_color   (guint i);
guint       gwy_graph_get_n_preset_colors   (void);

Description

Details

GwyGraphDataPoint

typedef struct {
    gdouble x;
    gdouble y;
} GwyGraphDataPoint;


GwyGraphActiveAreaSpecs

typedef struct {
    gint xmin;  /*x offset of the active area with respect to drawable left border*/
    gint ymin;  /*y offset of the active area with respect to drawable top border*/
    gint height;       /*active area height*/
    gint width;        /*active area width*/
    gdouble real_xmin; /*real units values*/
    gdouble real_ymin; /*real units values*/
    gdouble real_height; /*real units values*/
    gdouble real_width; /*real units values*/
    gboolean log_x;     /*x axis is logarithmic*/
    gboolean log_y;     /*y axis is logarithmic*/
} GwyGraphActiveAreaSpecs;


gwy_graph_draw_point ()

void        gwy_graph_draw_point            (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gint x,
                                             gint y,
                                             GwyGraphPointType type,
                                             gint size,
                                             const GwyRGBA *color,
                                             gboolean clear);

Draw a point on the graph.

drawable : a GdkDrawable
gc : a GdkGC graphics context
x : x coordinate of the point
y : y coordinate of the point
type : graph point type
size : point size
color : point color
clear :

gwy_graph_draw_line ()

void        gwy_graph_draw_line             (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gint x_from,
                                             gint y_from,
                                             gint x_to,
                                             gint y_to,
                                             GdkLineStyle line_style,
                                             gint size,
                                             const GwyRGBA *color);

Draw a line on the graph.

drawable : a GdkDrawable
gc : a GdkGC graphics context
x_from : x coordinate of the start point of the line
y_from : y coordinate of the start point of the line
x_to : x coordinate of the end point of the line
y_to : y coordinate of the end point of the line
line_style : graph line style
size : point size
color : point color

gwy_graph_draw_curve ()

void        gwy_graph_draw_curve            (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GObject *curvemodel);

Draw a curve on the graph

drawable : a GdkDrawable
gc : a GdkGC graphics context
specs : specifications (boundaries) of the active area of the graph
curvemodel : the curve model object

gwy_graph_draw_selection_points ()

void        gwy_graph_draw_selection_points (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraphPoint *selection);

Draw selection points on the graph

drawable : a GdkDrawable
gc : a GdkGC graphics context
specs : specifications (boundaries) of the active area of the graph
selection : a GwySelectionGraphPoint structure

gwy_graph_draw_selection_areas ()

void        gwy_graph_draw_selection_areas  (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraphArea *selection);

Draw selected area on the graph

drawable : a GdkDrawable
gc : a GdkGC graphics context
specs : specifications (boundaries) of the active area of the graph
selection : a GwySelectionGraphArea structure

gwy_graph_draw_selection_lines ()

void        gwy_graph_draw_selection_lines  (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraphLine *selection,
                                             GtkOrientation orientation);

Draw selected lines on the graph

drawable : a GdkDrawable
gc : a GdkGC graphics context
specs : specifications (boundaries) of the active area of the graph
selection : a GwySelectionGraphLine structure
orientation : horizontal or vertical orientation

gwy_graph_draw_selection_xareas ()

void        gwy_graph_draw_selection_xareas (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraph1DArea *selection);

Draw selected x-area on the graph

drawable : a GdkDrawable
gc : a GdkGC graphics context
specs : specifications (boundaries) of the active area of the graph
selection : a GwySelectionGraph1DArea structure

gwy_graph_draw_selection_yareas ()

void        gwy_graph_draw_selection_yareas (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GwySelectionGraph1DArea *selection);

Draw selected y-area on the graph

drawable : a GdkDrawable
gc : a GdkGC graphics context
specs : specifications (boundaries) of the active area of the graph
selection : a GwySelectionGraph1DArea structure

gwy_graph_draw_grid ()

void        gwy_graph_draw_grid             (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             GwyGraphActiveAreaSpecs *specs,
                                             GArray *x_grid_data,
                                             GArray *y_grid_data);

Draw array of grid lines on the graph

drawable : a GdkDrawable
gc : a GdkGC graphics context
specs : specifications (boundaries) of the active area of the graph
x_grid_data : array of grid data for the x-axis
y_grid_data : array of grid data for the y-axis

gwy_graph_get_preset_color ()

const GwyRGBA* gwy_graph_get_preset_color   (guint i);

Gets a preset graph color.

Preset colors are a set of selected colors one can use to distingush graph curves when there is no reason to prefer a particular color. Note they can change between version, even their number can change.

i : Color number, starting from 0 which is always black. It can be any number but colors start to repeat after gwy_graph_get_n_preset_colors() colors.
Returns : A constant color that must not be neither modified nor freed.

gwy_graph_get_n_preset_colors ()

guint       gwy_graph_get_n_preset_colors   (void);

Gets the number of distinct colors gwy_graph_get_preset_color() can return.

Returns : The number of distinct colors.