GwyGraph

GwyGraph — Widget for displaying graphs

Synopsis




            GwyGraph;
            GwyGraphClass;
GtkWidget*  gwy_graph_new                   (GwyGraphModel *gmodel);
void        gwy_graph_refresh               (GwyGraph *graph);
void        gwy_graph_change_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_signal_selected       (GwyGraph *grapher);
void        gwy_graph_signal_mouse_moved    (GwyGraph *grapher);
void        gwy_graph_signal_zoomed         (GwyGraph *grapher);
gint        gwy_graph_get_selection_number  (GwyGraph *graph);
void        gwy_graph_get_selection         (GwyGraph *graph,
                                             gdouble *selection);
void        gwy_graph_clear_selection       (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);
void        gwy_graph_export_pixmap         (GwyGraph *graph,
                                             const gchar *filename,
                                             gboolean export_title,
                                             gboolean export_axis,
                                             gboolean export_labels);
void        gwy_graph_export_postscript     (GwyGraph *graph,
                                             const gchar *filename,
                                             gboolean export_title,
                                             gboolean export_axis,
                                             gboolean export_labels);
void        gwy_graph_zoom_in               (GwyGraph *graph);
void        gwy_graph_zoom_out              (GwyGraph *graph);

Object Hierarchy


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

Implemented Interfaces

GwyGraph implements AtkImplementorIface.

Signal Prototypes


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

Description

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

GwyGraph is still in developement. Basic functionality and API is however allready set up. In the future, more API functions will be introduced probably.

Details

GwyGraph

typedef struct _GwyGraph GwyGraph;


GwyGraphClass

typedef struct {
    GtkTableClass parent_class;

    void (*gwygraph)(GwyGraph *grapher);
    void (*selected)(GwyGraph *grapher);
    void (*mouse_moved)(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_refresh ()

void        gwy_graph_refresh               (GwyGraph *graph);

Refresh all the graph widgets according to the model.

graph : A graph widget.

gwy_graph_change_model ()

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

Changes the graph model. Everything in graph widgets will be reset to the new data (from the model).

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 the way how the graph reacts on mouse events, basically. This includes point or area selectiuon and zooming.

graph : A graph widget.
status : new graph model

gwy_graph_get_status ()

GwyGraphStatusType gwy_graph_get_status     (GwyGraph *graph);

Get status of the graph widget. Status determines the way how the graph reacts on mouse events, basically. This includes point or area selectiuon 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 : GraphModel associated with this graph widget.

gwy_graph_signal_selected ()

void        gwy_graph_signal_selected       (GwyGraph *grapher);

grapher :

gwy_graph_signal_mouse_moved ()

void        gwy_graph_signal_mouse_moved    (GwyGraph *grapher);

grapher :

gwy_graph_signal_zoomed ()

void        gwy_graph_signal_zoomed         (GwyGraph *grapher);

grapher :

gwy_graph_get_selection_number ()

gint        gwy_graph_get_selection_number  (GwyGraph *graph);

Gets number of selections selected by user.

graph : A graph widget.
Returns : number of selections

gwy_graph_get_selection ()

void        gwy_graph_get_selection         (GwyGraph *graph,
                                             gdouble *selection);

Fills the selection field with current selection values. The values of selections are written to the field as (start_selection_1, end_selection_1, start_selection_2, ...) for GWY_GRAPH_STATUS_XSEL and GWY_GRAPH_STATUS_YSEL type selections, as (x1, y1, x2, y2,...) for GWY_GRAPH_STATUS_POINTS or GWY_GRAPH_STATUS_CURSOR type selections, as (x_start, y_start, width, height) for GWY_GRAPH_STATUS_ZOOM. The field mus be allready allocated, therefore the field size should match the maximum number of selections (that is by default 10 for each type and can be set by gwy_graph_set_selection_limit() function).

graph : A graph widget.
selection : allocated field of gdoubles

gwy_graph_clear_selection ()

void        gwy_graph_clear_selection       (GwyGraph *graph);

Clear all selections from the graph widget.

graph : A graph widget.

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 axes.

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 for setting the axis and area ranges for requested values. Note that the axis scales to have reasonably aligned ticks, therefore the result does need to match exactly the requsition falues. Use gwy_graph_get_x_range() if you want to know the result.

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

gwy_graph_request_y_range ()

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

Ask graph for setting the axis and area ranges for requested values. Note that the axis scales to have reasonably aligned ticks, therefore the result does need to match exactly the requsition falues. Use gwy_graph_get_y_range() if you want to know the result.

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

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 boudaries of graph area and axis in the y direction.

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 ()

void        gwy_graph_export_pixmap         (GwyGraph *graph,
                                             const gchar *filename,
                                             gboolean export_title,
                                             gboolean export_axis,
                                             gboolean export_labels);

graph :
filename :
export_title :
export_axis :
export_labels :

gwy_graph_export_postscript ()

void        gwy_graph_export_postscript     (GwyGraph *graph,
                                             const gchar *filename,
                                             gboolean export_title,
                                             gboolean export_axis,
                                             gboolean export_labels);

graph :
filename :
export_title :
export_axis :
export_labels :

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.

Signals

The "mouse-moved" 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 "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.