GwyGraph

GwyGraph — Widget for displaying graphs

Synopsis




            GwyGraphAutoProperties;
            GwyGraph;
            GwyGraphClass;
GtkWidget*  gwy_graph_new                   ();
void        gwy_graph_add_dataline_with_units
                                            (GwyGraph *graph,
                                             GwyDataLine *dataline,
                                             gdouble shift,
                                             GString *label,
                                             GwyGraphAreaCurveParams *params,
                                             gdouble x_order,
                                             gdouble y_order,
                                             char *x_unit,
                                             char *y_unit);
void        gwy_graph_add_dataline          (GwyGraph *graph,
                                             GwyDataLine *dataline,
                                             gdouble shift,
                                             GString *label,
                                             GwyGraphAreaCurveParams *params);
void        gwy_graph_add_datavalues        (GwyGraph *graph,
                                             gdouble *xvals,
                                             gdouble *yvals,
                                             gint n,
                                             GString *label,
                                             GwyGraphAreaCurveParams *params);
void        gwy_graph_clear                 (GwyGraph *graph);
void        gwy_graph_set_autoproperties    (GwyGraph *graph,
                                             GwyGraphAutoProperties *autoproperties);
void        gwy_graph_get_autoproperties    (GwyGraph *graph,
                                             GwyGraphAutoProperties *autoproperties);
void        gwy_graph_export_ascii          (GwyGraph *graph,
                                             const char *filename);
void        gwy_graph_set_status            (GwyGraph *graph,
                                             GwyGraphStatusType status);
GwyGraphStatusType gwy_graph_get_status     (GwyGraph *graph);
gpointer    gwy_graph_get_status_data       (GwyGraph *graph);
void        gwy_graph_get_boundaries        (GwyGraph *graph,
                                             gdouble *x_min,
                                             gdouble *x_max,
                                             gdouble *y_min,
                                             gdouble *y_max);
void        gwy_graph_set_boundaries        (GwyGraph *graph,
                                             gdouble x_min,
                                             gdouble x_max,
                                             gdouble y_min,
                                             gdouble y_max);
void        gwy_graph_unzoom                (GwyGraph *graph);
void        gwy_graph_get_data              (GwyGraph *graph,
                                             gdouble *xval,
                                             gdouble *yval,
                                             gint curve);
gint        gwy_graph_get_data_size         (GwyGraph *graph,
                                             gint curve);
gint        gwy_graph_get_number_of_curves  (GwyGraph *graph);
GString*    gwy_graph_get_label             (GwyGraph *graph,
                                             gint curve);
void        gwy_graph_enable_axis_label_edit
                                            (GwyGraph *graph,
                                             gboolean enable);

Object Hierarchy


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

Implemented Interfaces

GwyGraph implements AtkImplementorIface.

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

GwyGraphAutoProperties

typedef struct {
    gboolean is_line;
    gboolean is_point;
    gint line_size;
    gint point_size;
    GdkColor color;
} GwyGraphAutoProperties;

This structure corresponds to settings of display mode of data that are added with no specific display mode requests (lines/points, line color, etc.). For these data, drawing properties are determined automatically, in order to make curves distinguishable. These automatically generated curve properties are saved here.


GwyGraph

typedef struct _GwyGraph GwyGraph;


GwyGraphClass

typedef struct {
    GtkTableClass parent_class;

    void (*gwygraph)(GwyGraph *graph);

    gpointer reserved1;
    gpointer reserved2;
} GwyGraphClass;


gwy_graph_new ()

GtkWidget*  gwy_graph_new                   ();

Returns :

gwy_graph_add_dataline_with_units ()

void        gwy_graph_add_dataline_with_units
                                            (GwyGraph *graph,
                                             GwyDataLine *dataline,
                                             gdouble shift,
                                             GString *label,
                                             GwyGraphAreaCurveParams *params,
                                             gdouble x_order,
                                             gdouble y_order,
                                             char *x_unit,
                                             char *y_unit);

Adds a datalien into graph, setting units. Original dataline data will be divided by x_order and y_order factors and axis labels will have requested units.

graph : graph widget
dataline : dataline to be added
shift : x shift (dataline starts allways at zero)
label : curve label
params : parameters of curve (lines/points etc.)
x_order : division factor to obtain values corresponding to units
y_order : division factor to obtain values corresponding to units
x_unit : unit at x axis
y_unit : unit at y axis

gwy_graph_add_dataline ()

void        gwy_graph_add_dataline          (GwyGraph *graph,
                                             GwyDataLine *dataline,
                                             gdouble shift,
                                             GString *label,
                                             GwyGraphAreaCurveParams *params);

Adds a dataline into graph.

graph : graph widget
dataline : dataline to be added
shift : x shift (dataline starts allways at zero)
label : curve label
params : parameters of curve (lines/points etc.)

gwy_graph_add_datavalues ()

void        gwy_graph_add_datavalues        (GwyGraph *graph,
                                             gdouble *xvals,
                                             gdouble *yvals,
                                             gint n,
                                             GString *label,
                                             GwyGraphAreaCurveParams *params);

Adds raw data to the graph. Data are represented by two arrays of same size.

graph : graph widget
xvals : x values
yvals : y values
n : number of values
label : curve label
params : arameters of curve (lines/points etc.)

gwy_graph_clear ()

void        gwy_graph_clear                 (GwyGraph *graph);

Remove all curves.

graph : graph widget

gwy_graph_set_autoproperties ()

void        gwy_graph_set_autoproperties    (GwyGraph *graph,
                                             GwyGraphAutoProperties *autoproperties);

Sets the autoproperties - properties of curves added with no specification (color, point/line draw, etc.).

graph : graph widget
autoproperties : autoproperties of graph

gwy_graph_get_autoproperties ()

void        gwy_graph_get_autoproperties    (GwyGraph *graph,
                                             GwyGraphAutoProperties *autoproperties);

Gets the autoproperties - properties of curves added with no specification (color, point/line draw, etc.).

graph : graph widget
autoproperties : autoproperties of graph

gwy_graph_export_ascii ()

void        gwy_graph_export_ascii          (GwyGraph *graph,
                                             const char *filename);

graph :
filename :

gwy_graph_set_status ()

void        gwy_graph_set_status            (GwyGraph *graph,
                                             GwyGraphStatusType status);

sets the graph status. The status is related with ability to do different mouse selections.

graph : graph widget
status : graph status to be set

gwy_graph_get_status ()

GwyGraphStatusType gwy_graph_get_status     (GwyGraph *graph);

gets the graph status. The status is related with ability to do different mouse selections.

graph : graph widget
Returns : current graph status

gwy_graph_get_status_data ()

gpointer    gwy_graph_get_status_data       (GwyGraph *graph);

gets the graph status data - data corresponding to mouse selections done by user. Actual contain cooresponds on status type.

graph : graph widget
Returns : pointer to status data.

gwy_graph_get_boundaries ()

void        gwy_graph_get_boundaries        (GwyGraph *graph,
                                             gdouble *x_min,
                                             gdouble *x_max,
                                             gdouble *y_min,
                                             gdouble *y_max);

graph : graph widget
x_min : x axis minimum value
x_max : x axis maximum value
y_min : y axis minimum value
y_max : y axis maximum value

gwy_graph_set_boundaries ()

void        gwy_graph_set_boundaries        (GwyGraph *graph,
                                             gdouble x_min,
                                             gdouble x_max,
                                             gdouble y_min,
                                             gdouble y_max);

Sets actual axis boundaries of graph. Recomputes and redisplays all necessary things.

graph : graph widget
x_min : x axis minimum value
x_max : x axis maximum value
y_min : y axis minimum value
y_max : y axis maximum value

gwy_graph_unzoom ()

void        gwy_graph_unzoom                (GwyGraph *graph);

resets zoom. Fits all curves into graph.

graph : graph widget

gwy_graph_get_data ()

void        gwy_graph_get_data              (GwyGraph *graph,
                                             gdouble *xval,
                                             gdouble *yval,
                                             gint curve);

Extracts data of a curve.

graph : graph widget
xval : x data points
yval : y data points
curve : curve to be extracted

Since 1.2.


gwy_graph_get_data_size ()

gint        gwy_graph_get_data_size         (GwyGraph *graph,
                                             gint curve);

graph :
curve :
Returns :

Since 1.2.


gwy_graph_get_number_of_curves ()

gint        gwy_graph_get_number_of_curves  (GwyGraph *graph);

graph : graph widget
Returns : total number of curves within graph widget

Since 1.2.


gwy_graph_get_label ()

GString*    gwy_graph_get_label             (GwyGraph *graph,
                                             gint curve);

Return the label of a graph curve.

graph : A graph wiget.
curve : Graph curve to get label of.
Returns : The label as a GString. Note the label itself is returned, not a copy, you should treat it as constat.

Since 1.2.


gwy_graph_enable_axis_label_edit ()

void        gwy_graph_enable_axis_label_edit
                                            (GwyGraph *graph,
                                             gboolean enable);

graph :
enable :