GwyGraph

GwyGraph — Widget for displaying graphs

Synopsis




            GwyGraph;
            GwyGraphClass;
GtkWidget*  gwy_graph_new                   (GwyGraphModel *gmodel);
GwyAxis*    gwy_graph_get_axis              (GwyGraph *graph,
                                             GtkPositionType type);
void        gwy_graph_set_axis_visible      (GwyGraph *graph,
                                             GtkPositionType type,
                                             gboolean is_visible);
GtkWidget*  gwy_graph_get_area              (GwyGraph *graph);
void        gwy_graph_set_model             (GwyGraph *graph,
                                             GwyGraphModel *gmodel);
void        gwy_graph_set_status            (GwyGraph *graph,
                                             GwyGraphStatusType status);
GwyGraphStatusType gwy_graph_get_status     (GwyGraph *graph);
GwyGraphModel* gwy_graph_get_model          (GwyGraph *graph);
void        gwy_graph_get_cursor            (GwyGraph *graph,
                                             gdouble *x_cursor,
                                             gdouble *y_cursor);
void        gwy_graph_request_x_range       (GwyGraph *graph,
                                             gdouble x_min_req,
                                             gdouble x_max_req);
void        gwy_graph_request_y_range       (GwyGraph *graph,
                                             gdouble y_min_req,
                                             gdouble y_max_req);
void        gwy_graph_get_x_range           (GwyGraph *graph,
                                             gdouble *x_min,
                                             gdouble *x_max);
void        gwy_graph_get_y_range           (GwyGraph *graph,
                                             gdouble *y_min,
                                             gdouble *y_max);
void        gwy_graph_enable_user_input     (GwyGraph *graph,
                                             gboolean enable);
GdkPixbuf*  gwy_graph_export_pixmap         (GwyGraph *graph,
                                             gboolean export_title,
                                             gboolean export_axis,
                                             gboolean export_labels,
                                             GdkPixbuf *pixbuf);
GString*    gwy_graph_export_postscript     (GwyGraph *graph,
                                             gboolean export_title,
                                             gboolean export_axis,
                                             gboolean export_labels,
                                             GString *str);
void        gwy_graph_zoom_in               (GwyGraph *graph);
void        gwy_graph_zoom_out              (GwyGraph *graph);
void        gwy_graph_set_grid_type         (GwyGraph *graph,
                                             GwyGraphGridType grid_type);
GwyGraphGridType gwy_graph_get_grid_type    (GwyGraph *graph);
void        gwy_graph_set_x_grid_data       (GwyGraph *graph,
                                             GArray *grid_data);
void        gwy_graph_set_y_grid_data       (GwyGraph *graph,
                                             GArray *grid_data);
const GArray* gwy_graph_get_x_grid_data     (GwyGraph *graph);
const GArray* gwy_graph_get_y_grid_data     (GwyGraph *graph);

Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkContainer
                     +----GtkTable
                           +----GwyGraph

Implemented Interfaces

GwyGraph implements AtkImplementorIface.

Signal Prototypes


"selected"  void        user_function      (GwyGraph *gwygraph,
                                            gpointer user_data);
"zoomed"    void        user_function      (GwyGraph *gwygraph,
                                            gpointer user_data);

Description

GwyGraph is a basic widget for displaying graphs. It consists of several widgets that can also be used separately. However, it is recomended (and it should be easy) to use the whole GwyGraph widget and its API for most purposes.

Details

GwyGraph

typedef struct _GwyGraph GwyGraph;


GwyGraphClass

typedef struct {
    GtkTableClass parent_class;

    void (*gwygraph)(GwyGraph *grapher);
    void (*selected)(GwyGraph *grapher);
    void (*zoomed)(GwyGraph *grapher);

    gpointer reserved1;
    gpointer reserved2;
} GwyGraphClass;


gwy_graph_new ()

GtkWidget*  gwy_graph_new                   (GwyGraphModel *gmodel);

Creates graph widget based on information in model.

gmodel : A graph model.
Returns : new graph widget.

gwy_graph_get_axis ()

GwyAxis*    gwy_graph_get_axis              (GwyGraph *graph,
                                             GtkPositionType type);

graph : A graph widget.
type : Axis orientation
Returns : the GwyAxis (of given orientation) within graph (do not free).

gwy_graph_set_axis_visible ()

void        gwy_graph_set_axis_visible      (GwyGraph *graph,
                                             GtkPositionType type,
                                             gboolean is_visible);

Sets the visibility of graph axis of given orientation. Visibility can be set also directly using GwyAxis API.

graph : A graph widget.
type : Axis orientation
is_visible : set/unset axis visibility within graph widget

gwy_graph_get_area ()

GtkWidget*  gwy_graph_get_area              (GwyGraph *graph);

graph : A graph widget.
Returns : the GwyGraphArea within graph (do not free).

gwy_graph_set_model ()

void        gwy_graph_set_model             (GwyGraph *graph,
                                             GwyGraphModel *gmodel);

Changes the graph model.

Everything in graph widgets will be reset to reflect the new data. gmodel is duplicated.

graph : A graph widget.
gmodel : new graph model

gwy_graph_set_status ()

void        gwy_graph_set_status            (GwyGraph *graph,
                                             GwyGraphStatusType status);

Set status of the graph widget. Status determines how the graph reacts on mouse events. This includes point or area selection and zooming.

graph : A graph widget.
status : graph status

gwy_graph_get_status ()

GwyGraphStatusType gwy_graph_get_status     (GwyGraph *graph);

Get status of the graph widget. Status determines how the graph reacts on mouse events. This includes point or area selection and zooming.

graph : A graph widget.
Returns : graph status

gwy_graph_get_model ()

GwyGraphModel* gwy_graph_get_model          (GwyGraph *graph);

graph : A graph widget.
Returns : Graph model associated with this graph widget (do not free).

gwy_graph_get_cursor ()

void        gwy_graph_get_cursor            (GwyGraph *graph,
                                             gdouble *x_cursor,
                                             gdouble *y_cursor);

Get the mouse pointer position within the graph area. Values are in physical units corresponding to the graph axis.

graph : A graph widget.
x_cursor : x position of cursor
y_cursor : y position of cursor

gwy_graph_request_x_range ()

void        gwy_graph_request_x_range       (GwyGraph *graph,
                                             gdouble x_min_req,
                                             gdouble x_max_req);

Ask graph to set the axis and area ranges to the requested values. Note that the axis scales must have reasonably aligned ticks, therefore the result might not exactly match the requested values. Use gwy_graph_get_x_range() if you want to know the result.

graph : A graph widget.
x_min_req : x minimum request
x_max_req : x maximum request

gwy_graph_request_y_range ()

void        gwy_graph_request_y_range       (GwyGraph *graph,
                                             gdouble y_min_req,
                                             gdouble y_max_req);

Ask graph to set the axis and area ranges to the requested values. Note that the axis scales must have reasonably aligned ticks, therefore the result might not exactly match the requested values. Use gwy_graph_get_y_range() if you want to know the result.

graph : A graph widget.
y_min_req : y minimum request
y_max_req : y maximum request

gwy_graph_get_x_range ()

void        gwy_graph_get_x_range           (GwyGraph *graph,
                                             gdouble *x_min,
                                             gdouble *x_max);

Get the actual boudaries of graph area and axis in the x direction.

graph : A graph widget.
x_min : x minimum
x_max : x maximum

gwy_graph_get_y_range ()

void        gwy_graph_get_y_range           (GwyGraph *graph,
                                             gdouble *y_min,
                                             gdouble *y_max);

Get the actual boundaries of graph area and axis in the y direction and store them in y_min and y_max.

graph : A graph widget.
y_min : y minimum
y_max : y maximum

gwy_graph_enable_user_input ()

void        gwy_graph_enable_user_input     (GwyGraph *graph,
                                             gboolean enable);

Enables/disables all the graph/curve settings dialogs to be invoked by mouse clicks.

graph : A graph widget.
enable : whether to enable user input

gwy_graph_export_pixmap ()

GdkPixbuf*  gwy_graph_export_pixmap         (GwyGraph *graph,
                                             gboolean export_title,
                                             gboolean export_axis,
                                             gboolean export_labels,
                                             GdkPixbuf *pixbuf);

graph :
export_title :
export_axis :
export_labels :
pixbuf :
Returns :

gwy_graph_export_postscript ()

GString*    gwy_graph_export_postscript     (GwyGraph *graph,
                                             gboolean export_title,
                                             gboolean export_axis,
                                             gboolean export_labels,
                                             GString *str);

graph :
export_title :
export_axis :
export_labels :
str :
Returns :

gwy_graph_zoom_in ()

void        gwy_graph_zoom_in               (GwyGraph *graph);

Switch to zoom status. Graph will expect zoom selection and will zoom afterwards automatically.

graph : A graph widget.

gwy_graph_zoom_out ()

void        gwy_graph_zoom_out              (GwyGraph *graph);

Zoom out to see all the data points.

graph : A graph widget.

gwy_graph_set_grid_type ()

void        gwy_graph_set_grid_type         (GwyGraph *graph,
                                             GwyGraphGridType grid_type);

Set the graph to a particular grid type.

graph : A graph widget.
grid_type : The type of grid the graph should be set to

gwy_graph_get_grid_type ()

GwyGraphGridType gwy_graph_get_grid_type    (GwyGraph *graph);

Return: The grid type of the graph.

graph : A graph widget.
Returns :

gwy_graph_set_x_grid_data ()

void        gwy_graph_set_x_grid_data       (GwyGraph *graph,
                                             GArray *grid_data);

Set the grid data for the x-axis of the graph area. grid_data is duplicated.

graph : A graph widget.
grid_data : An array of grid data

gwy_graph_set_y_grid_data ()

void        gwy_graph_set_y_grid_data       (GwyGraph *graph,
                                             GArray *grid_data);

Set the grid data for the y-axis of the graph area. grid_data is duplicated.

graph : A graph widget.
grid_data : An array of grid data

gwy_graph_get_x_grid_data ()

const GArray* gwy_graph_get_x_grid_data     (GwyGraph *graph);

Return: Array of grid data for the x-axis of the graph area (do not free).

graph : A graph widget.
Returns :

gwy_graph_get_y_grid_data ()

const GArray* gwy_graph_get_y_grid_data     (GwyGraph *graph);

Return: Array of grid data for the y-axis of the graph area (do not free).

graph : A graph widget.
Returns :

Signals

The "selected" signal

void        user_function                  (GwyGraph *gwygraph,
                                            gpointer user_data);

gwygraph : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "zoomed" signal

void        user_function                  (GwyGraph *gwygraph,
                                            gpointer user_data);

gwygraph : the object which received the signal.
user_data : user data set when the signal handler was connected.