GwyGraphArea

GwyGraphArea — Layout for drawing graph curves.

Synopsis




            GwyGraphAreaCurvePoints;
enum        GwyGraphStatusType;
            GwyGraphDataPoint;
            GwyGraphScrPoint;
            GwyGraphStatus_CursorData;
            GwyGraphStatus_SelData;
            GwyGraphStatus_PointsData;
            GwyGraphStatus_ZoomData;
            GwyGraphAreaCurve;
            GwyGraphAreaParams;
            GwyGraphArea;
            GwyGraphAreaClass;
GtkWidget*  gwy_graph_area_new              (GtkAdjustment *hadjustment,
                                             GtkAdjustment *vadjustment);
void        gwy_graph_area_set_style        (GwyGraphArea *area,
                                             GwyGraphAreaParams style);
void        gwy_graph_area_set_boundaries   (GwyGraphArea *area,
                                             gdouble x_min,
                                             gdouble x_max,
                                             gdouble y_min,
                                             gdouble y_max);
void        gwy_graph_area_add_curve        (GwyGraphArea *area,
                                             GwyGraphAreaCurve *curve);
void        gwy_graph_area_clear            (GwyGraphArea *area);
void        gwy_graph_area_signal_selected  (GwyGraphArea *area);
void        gwy_graph_area_signal_zoomed    (GwyGraphArea *area);
void        gwy_graph_area_set_selection    (GwyGraphArea *area,
                                             gdouble from,
                                             gdouble to);

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

This widget is a part of GwyGraph widget. It is recommended to use it within the GwyGraph widget, however, it can be used separately. It plots a set of data curves with a given plot properties.

Details

GwyGraphAreaCurvePoints

typedef struct {
    gdouble *xvals;     /*screen coordinates of points*/
    gdouble *yvals;     /*screen coordinates of points*/
    gint N;              /*number of points*/
} GwyGraphAreaCurvePoints;


enum GwyGraphStatusType

typedef enum {
    GWY_GRAPH_STATUS_PLAIN  = 0,
    GWY_GRAPH_STATUS_CURSOR = 1,
    GWY_GRAPH_STATUS_XSEL   = 2,
    GWY_GRAPH_STATUS_YSEL   = 3,
    GWY_GRAPH_STATUS_POINTS = 4,
    GWY_GRAPH_STATUS_ZOOM   = 5
} GwyGraphStatusType;


GwyGraphDataPoint

typedef struct {
   gdouble x;
   gdouble y;
   char *x_unit;
   char *y_unit;
} GwyGraphDataPoint;


GwyGraphScrPoint

typedef struct {
   gdouble i;
   gdouble j;
} GwyGraphScrPoint;


GwyGraphStatus_CursorData

typedef struct {
   GwyGraphScrPoint scr_point;
   GwyGraphDataPoint data_point;
} GwyGraphStatus_CursorData;


GwyGraphStatus_SelData

typedef struct {
   gint scr_start;
   gint scr_end;
   gdouble data_start;
   gdouble data_end;
} GwyGraphStatus_SelData;


GwyGraphStatus_PointsData

typedef struct {
   GwyGraphScrPoint actual_scr_point;
   GwyGraphDataPoint actual_data_point;
   GArray *scr_points;
   GArray *data_points;
   gint n;
} GwyGraphStatus_PointsData;


GwyGraphStatus_ZoomData

typedef struct {
  gint x;
  gint y;
  gint width;
  gint height;
  gdouble xmin;
  gdouble xmax;
  gdouble ymin;
  gdouble ymax;
} GwyGraphStatus_ZoomData;


GwyGraphAreaCurve

typedef struct {
    GwyGraphAreaCurvePoints data;       /*original data including its size*/
    GwyGraphAreaCurveParams params;     /*parameters of plot*/
    GdkPoint *points;           /*points to be directly plotted*/
    
    gpointer reserved;
} GwyGraphAreaCurve;


GwyGraphAreaParams

typedef struct {
    int ble;
} GwyGraphAreaParams;


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

hadjustment :
vadjustment :
Returns :

gwy_graph_area_set_style ()

void        gwy_graph_area_set_style        (GwyGraphArea *area,
                                             GwyGraphAreaParams style);

area :
style :

gwy_graph_area_set_boundaries ()

void        gwy_graph_area_set_boundaries   (GwyGraphArea *area,
                                             gdouble x_min,
                                             gdouble x_max,
                                             gdouble y_min,
                                             gdouble y_max);

Sets the boudaries of graph area and calls for recomputation of actual curve screen representation and its redrawing. used for example by zoom to change curve screen representation.

area : graph area
x_min : x minimum
x_max : x maximum
y_min : y minimim
y_max : y maximum

gwy_graph_area_add_curve ()

void        gwy_graph_area_add_curve        (GwyGraphArea *area,
                                             GwyGraphAreaCurve *curve);

Adds a curve to graph. Adds the curve data values, but the recomputation of actual screen points representing curve must be called after setting the boundaries of the graph area (and complete graph).

area : graph area
curve : curve to be added

gwy_graph_area_clear ()

void        gwy_graph_area_clear            (GwyGraphArea *area);

clear graph area

area : graph area

gwy_graph_area_signal_selected ()

void        gwy_graph_area_signal_selected  (GwyGraphArea *area);

emit signal that something was selected by mouse. "Something" depends on the actual graph status (points, horizontal selection, etc.).

area : graph area

gwy_graph_area_signal_zoomed ()

void        gwy_graph_area_signal_zoomed    (GwyGraphArea *area);

emit signal that user finished drawing zoom rectangle by mouse.

area : graph area

gwy_graph_area_set_selection ()

void        gwy_graph_area_set_selection    (GwyGraphArea *area,
                                             gdouble from,
                                             gdouble to);

area :
from :
to :

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.