GwyGraphArea

GwyGraphArea — Layout for drawing graph curves.

Synopsis




struct      GwyGraphAreaCurvePoints;
enum        GwyGraphStatusType;
struct      GwyGraphDataPoint;
struct      GwyGraphScrPoint;
struct      GwyGraphStatus_CursorData;
struct      GwyGraphStatus_SelData;
struct      GwyGraphStatus_PointsData;
struct      GwyGraphStatus_ZoomData;
struct      GwyGraphAreaCurve;
struct      GwyGraphAreaParams;
struct      GwyGraphArea;
struct      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);

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

struct GwyGraphAreaCurvePoints

struct GwyGraphAreaCurvePoints {

    gdouble *xvals;     /*screen coordinates of points*/
    gdouble *yvals;     /*screen coordinates of points*/
    gint N;              /*number of points*/
};


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;


struct GwyGraphDataPoint

struct GwyGraphDataPoint {

   gdouble x;
   gdouble y;
   char *x_unit;
   char *y_unit;
};


struct GwyGraphScrPoint

struct GwyGraphScrPoint {

   gdouble i;
   gdouble j;
};


struct GwyGraphStatus_CursorData

struct GwyGraphStatus_CursorData {

   GwyGraphScrPoint scr_point;
   GwyGraphDataPoint data_point;
};


struct GwyGraphStatus_SelData

struct GwyGraphStatus_SelData {

   gint scr_start;
   gint scr_end;
   gdouble data_start;
   gdouble data_end;
};


struct GwyGraphStatus_PointsData

struct GwyGraphStatus_PointsData {

   GwyGraphScrPoint actual_scr_point;
   GwyGraphDataPoint actual_data_point;
   GArray *scr_points;
   GArray *data_points;
   gint n;
};


struct GwyGraphStatus_ZoomData

struct GwyGraphStatus_ZoomData {

  gint x;
  gint y;
  gint width;
  gint height;
  gdouble xmin;
  gdouble xmax;
  gdouble ymin;
  gdouble ymax;
};


struct GwyGraphAreaCurve

struct GwyGraphAreaCurve {

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


struct GwyGraphAreaParams

struct GwyGraphAreaParams {

    int ble;
};


struct GwyGraphArea

struct GwyGraphArea;


struct GwyGraphAreaClass

struct GwyGraphAreaClass {

    GtkLayoutClass parent_class;

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


    gpointer reserved1;
    gpointer reserved2;
};


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

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.