GwyGraphArea

GwyGraphArea — Layout for drawing graph curves

Synopsis




            GwyGraphStatus_PointData;
            GwyGraphStatus_CursorData;
            GwyGraphStatus_ZoomData;
            GwyGraphAreaCurve;
            GwyGraphArea;
            GwyGraphAreaClass;
GtkWidget*  gwy_graph_area_new              (GtkAdjustment *hadjustment,
                                             GtkAdjustment *vadjustment);
GtkWidget*  gwy_graph_area_get_label        (GwyGraphArea *area);
void        gwy_graph_area_refresh          (GwyGraphArea *area);
void        gwy_graph_area_set_selection    (GwyGraphArea *area,
                                             GwyGraphStatusType status,
                                             gdouble *selection,
                                             gint n_of_selections);
void        gwy_graph_area_set_selection_limit
                                            (GwyGraphArea *area,
                                             gint limit);
gint        gwy_graph_area_get_selection_limit
                                            (GwyGraphArea *area);
void        gwy_graph_area_set_model        (GwyGraphArea *area,
                                             gpointer gmodel);
gint        gwy_graph_area_get_selection_number
                                            (GwyGraphArea *area);
void        gwy_graph_area_get_selection    (GwyGraphArea *area,
                                             gdouble *selection);
void        gwy_graph_area_clear_selection  (GwyGraphArea *area);
void        gwy_graph_area_draw_area_on_drawable
                                            (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gint x,
                                             gint y,
                                             gint width,
                                             gint height,
                                             GwyGraphArea *area);
GString*    gwy_graph_area_export_vector    (GwyGraphArea *area,
                                             gint x,
                                             gint y,
                                             gint width,
                                             gint height);
void        gwy_graph_area_enable_user_input
                                            (GwyGraphArea *area,
                                             gboolean enable);
void        gwy_graph_area_get_cursor       (GwyGraphArea *area,
                                             gdouble *x_cursor,
                                             gdouble *y_cursor);
void        gwy_graph_area_set_x_grid_data  (GwyGraphArea *area,
                                             GArray *grid_data);
void        gwy_graph_area_set_y_grid_data  (GwyGraphArea *area,
                                             GArray *grid_data);
const GArray* gwy_graph_area_get_x_grid_data
                                            (GwyGraphArea *area);
const GArray* gwy_graph_area_get_y_grid_data
                                            (GwyGraphArea *area);

Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkContainer
                     +----GtkLayout
                           +----GwyGraphArea

Implemented Interfaces

GwyGraphArea implements AtkImplementorIface.

Signal Prototypes


"selected"  void        user_function      (GwyGraphArea *gwygrapharea,
                                            gpointer user_data);
"zoomed"    void        user_function      (GwyGraphArea *gwygrapharea,
                                            gpointer user_data);

Description

GwyGraphArea is the central part of GwyGraph widget. It plots a set of data curves with the given plot properties.

It is recommended to use it within GwyGraph, however, it can also be used separately.

Details

GwyGraphStatus_PointData

typedef struct {
  GwyGraphDataPoint data_point;
} GwyGraphStatus_PointData;


GwyGraphStatus_CursorData

typedef struct {
  GwyGraphDataPoint data_point;
} GwyGraphStatus_CursorData;


GwyGraphStatus_ZoomData

typedef struct {
  gdouble xmin;
  gdouble ymin;
  gdouble width;
  gdouble height;
} GwyGraphStatus_ZoomData;


GwyGraphAreaCurve

typedef struct {
    GdkPoint *points;           /*points to be directly plotted*/

    gpointer reserved;
} GwyGraphAreaCurve;


GwyGraphArea

typedef struct _GwyGraphArea GwyGraphArea;


GwyGraphAreaClass

typedef struct {
    GtkLayoutClass parent_class;

    GdkCursor *cross_cursor;
    GdkCursor *arrow_cursor;
    void (*selected)(GwyGraphArea *area);
    void (*zoomed)(GwyGraphArea *area);

    gpointer reserved1;
    gpointer reserved2;
} GwyGraphAreaClass;


gwy_graph_area_new ()

GtkWidget*  gwy_graph_area_new              (GtkAdjustment *hadjustment,
                                             GtkAdjustment *vadjustment);

Creates a graph area widget.

hadjustment : horizontal adjustment (assigns lower and upper bounds as well as increments to the horizontal axis of the new graph area)
vadjustment : vertical adjustment (assigns lower and upper bounds as well as increments to the vertical axis of the new graph area)
Returns : new GwyGraphArea widget.

gwy_graph_area_get_label ()

GtkWidget*  gwy_graph_area_get_label        (GwyGraphArea *area);

area : graph area
Returns : the GwyGraphLabel within area (do not free).

gwy_graph_area_refresh ()

void        gwy_graph_area_refresh          (GwyGraphArea *area);

Refreshes the area with respect to graph model.

area : graph area

gwy_graph_area_set_selection ()

void        gwy_graph_area_set_selection    (GwyGraphArea *area,
                                             GwyGraphStatusType status,
                                             gdouble *selection,
                                             gint n_of_selections);

Set selection data for given values and status. Refresh graph area after doing this to see any change.

area : graph area
status : status of selection to be set
selection : selection data field
n_of_selections : number of selections to be set

gwy_graph_area_set_selection_limit ()

void        gwy_graph_area_set_selection_limit
                                            (GwyGraphArea *area,
                                             gint limit);

Set maximum number of selections done by mouse

area : graph area
limit : maximum muber of selections

gwy_graph_area_get_selection_limit ()

gint        gwy_graph_area_get_selection_limit
                                            (GwyGraphArea *area);

area : graph area
Returns : maximum number of selections done by mouse

gwy_graph_area_set_model ()

void        gwy_graph_area_set_model        (GwyGraphArea *area,
                                             gpointer gmodel);

Changes the graph model. Calls refresh afterwards. gmodel is duplicated.

area : graph area
gmodel : new graph model

gwy_graph_area_get_selection_number ()

gint        gwy_graph_area_get_selection_number
                                            (GwyGraphArea *area);

Gets number of selections selected by user.

area : A graph area widget.
Returns : number of selections

gwy_graph_area_get_selection ()

void        gwy_graph_area_get_selection    (GwyGraphArea *area,
                                             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).

area :
selection : allocated field of gdoubles

gwy_graph_area_clear_selection ()

void        gwy_graph_area_clear_selection  (GwyGraphArea *area);

Clear all the selections. If you use graph area as a part of GwyGraph, use the GwyGraph clear selection function preferably.

area : graph area

gwy_graph_area_draw_area_on_drawable ()

void        gwy_graph_area_draw_area_on_drawable
                                            (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gint x,
                                             gint y,
                                             gint width,
                                             gint height,
                                             GwyGraphArea *area);

Draws the graph area to a GdkDrawable.

drawable : a GdkDrawable (destination for graphics operations)
gc : a GdkGC graphics context
x : X position in drawable where the graph area should be drawn
y : Y position in drawable where the graph area should be drawn
width : width of the graph area on the drawable
height : height of the graph area on the drawable
area : the graph area to draw

gwy_graph_area_export_vector ()

GString*    gwy_graph_area_export_vector    (GwyGraphArea *area,
                                             gint x,
                                             gint y,
                                             gint width,
                                             gint height);

area : the graph area to export
x :
y :
width :
height :
Returns :

gwy_graph_area_enable_user_input ()

void        gwy_graph_area_enable_user_input
                                            (GwyGraphArea *area,
                                             gboolean enable);

Enables/disables all the user input dialogs (to be invoked by clicking the mouse).

area : graph area
enable : enable/disable user input

gwy_graph_area_get_cursor ()

void        gwy_graph_area_get_cursor       (GwyGraphArea *area,
                                             gdouble *x_cursor,
                                             gdouble *y_cursor);

Gets mouse cursor related values within graph area.

area : graph area
x_cursor : x value corresponding to cursor position
y_cursor : y value corresponding to cursor position

gwy_graph_area_set_x_grid_data ()

void        gwy_graph_area_set_x_grid_data  (GwyGraphArea *area,
                                             GArray *grid_data);

Sets the grid data on the x-axis of the graph area

area : graph area
grid_data : array of grid data on the x axis

gwy_graph_area_set_y_grid_data ()

void        gwy_graph_area_set_y_grid_data  (GwyGraphArea *area,
                                             GArray *grid_data);

Sets the grid data on the y-axis of the graph area

area : graph area
grid_data : array of grid data on the y axis

gwy_graph_area_get_x_grid_data ()

const GArray* gwy_graph_area_get_x_grid_data
                                            (GwyGraphArea *area);

area : graph area
Returns : the grid data on the x-axis of the graph area as a GArray (do not free).

gwy_graph_area_get_y_grid_data ()

const GArray* gwy_graph_area_get_y_grid_data
                                            (GwyGraphArea *area);

area : graph area
Returns : the grid data on the y-axis of the graph area as a GArray (do not free).

Signals

The "selected" signal

void        user_function                  (GwyGraphArea *gwygrapharea,
                                            gpointer user_data);

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

The "zoomed" signal

void        user_function                  (GwyGraphArea *gwygrapharea,
                                            gpointer user_data);

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