GwyGraphModel

GwyGraphModel — Representation of a graph

Synopsis




            GwyGraphModel;
            GwyGraphModelClass;
#define     gwy_graph_model_duplicate       (gmodel)
GwyGraphModel* gwy_graph_model_new          (void);
GwyGraphModel* gwy_graph_model_new_alike    (GwyGraphModel *gmodel);
gint        gwy_graph_model_get_n_curves    (GwyGraphModel *gmodel);
void        gwy_graph_model_add_curve       (GwyGraphModel *gmodel,
                                             GwyGraphCurveModel *curve);
gint        gwy_graph_model_remove_curve_by_description
                                            (GwyGraphModel *gmodel,
                                             const gchar *description);
void        gwy_graph_model_remove_curve_by_index
                                            (GwyGraphModel *gmodel,
                                             gint cindex);
GwyGraphCurveModel* gwy_graph_model_get_curve_by_description
                                            (GwyGraphModel *gmodel,
                                             const gchar *description);
GwyGraphCurveModel* gwy_graph_model_get_curve_by_index
                                            (GwyGraphModel *gmodel,
                                             gint cindex);
void        gwy_graph_model_remove_all_curves
                                            (GwyGraphModel *gmodel);
void        gwy_graph_model_set_title       (GwyGraphModel *model,
                                             const gchar *title);
void        gwy_graph_model_set_label_position
                                            (GwyGraphModel *model,
                                             GwyGraphLabelPosition position);
void        gwy_graph_model_set_label_has_frame
                                            (GwyGraphModel *model,
                                             gboolean label_has_frame);
void        gwy_graph_model_set_label_frame_thickness
                                            (GwyGraphModel *model,
                                             gint thickness);
void        gwy_graph_model_set_label_reverse
                                            (GwyGraphModel *model,
                                             gboolean reverse);
void        gwy_graph_model_set_label_visible
                                            (GwyGraphModel *model,
                                             gboolean visible);
void        gwy_graph_model_set_si_unit_x   (GwyGraphModel *model,
                                             GwySIUnit *siunit);
void        gwy_graph_model_set_si_unit_y   (GwyGraphModel *model,
                                             GwySIUnit *siunit);
void        gwy_graph_model_set_units_from_data_line
                                            (GwyGraphModel *model,
                                             GwyDataLine *data_line);
const gchar* gwy_graph_model_get_title      (GwyGraphModel *model);
GwyGraphLabelPosition gwy_graph_model_get_label_position
                                            (GwyGraphModel *model);
gboolean    gwy_graph_model_get_label_has_frame
                                            (GwyGraphModel *model);
gint        gwy_graph_model_get_label_frame_thickness
                                            (GwyGraphModel *model);
gboolean    gwy_graph_model_get_label_reverse
                                            (GwyGraphModel *model);
gboolean    gwy_graph_model_get_label_visible
                                            (GwyGraphModel *model);
GwySIUnit*  gwy_graph_model_get_si_unit_x   (GwyGraphModel *model);
GwySIUnit*  gwy_graph_model_get_si_unit_y   (GwyGraphModel *model);
GString*    gwy_graph_model_export_ascii    (GwyGraphModel *model,
                                             const gchar *filename,
                                             gboolean export_units,
                                             gboolean export_labels,
                                             gboolean export_metadata,
                                             GwyGraphModelExportStyle export_style,
                                             GString *string);
void        gwy_graph_model_signal_layout_changed
                                            (GwyGraphModel *model);
void        gwy_graph_model_set_direction_logarithmic
                                            (GwyGraphModel *model,
                                             GtkOrientation direction,
                                             gboolean is_logarithmic);
gboolean    gwy_graph_model_get_direction_logarithmic
                                            (GwyGraphModel *model,
                                             GtkOrientation direction);
gboolean    gwy_graph_model_x_data_can_be_logarithmed
                                            (GwyGraphModel *model);
gboolean    gwy_graph_model_y_data_can_be_logarithmed
                                            (GwyGraphModel *model);

Object Hierarchy


  GObject
   +----GwyGraphModel

Implemented Interfaces

GwyGraphModel implements GwySerializable.

Properties


  "n"                    gint                  : Read
  "title"                gchararray            : Read / Write

Signal Prototypes


"layout-updated"
            void        user_function      (GwyGraphModel *gwygraphmodel,
                                            gpointer user_data);

Description

GwyGraphModel represents information about a graph necessary to fully reconstruct it.

Details

GwyGraphModel

typedef struct _GwyGraphModel GwyGraphModel;


GwyGraphModelClass

typedef struct {
    GObjectClass parent_class;

    void (*layout_updated)(GwyGraphModel *gmodel);

    gpointer reserved2;
    gpointer reserved3;
    gpointer reserved4;
    gpointer reserved5;
} GwyGraphModelClass;


gwy_graph_model_duplicate()

#define     gwy_graph_model_duplicate(gmodel)

Convenience macro doing gwy_serializable_duplicate() with all the necessary typecasting.

gmodel : A graph model to duplicate.

gwy_graph_model_new ()

GwyGraphModel* gwy_graph_model_new          (void);

Creates a new graph model.

Returns : New graph model as a GObject.

gwy_graph_model_new_alike ()

GwyGraphModel* gwy_graph_model_new_alike    (GwyGraphModel *gmodel);

Creates new graph model object that has the same settings as gmodel. This includes axis/label visibility, actual plotting range, etc. Curves are not duplicated or referenced.

gmodel : A GwyGraphModel.
Returns : New graph model.

gwy_graph_model_get_n_curves ()

gint        gwy_graph_model_get_n_curves    (GwyGraphModel *gmodel);

gmodel : A GwyGraphModel.
Returns : number of curves in graph model.

gwy_graph_model_add_curve ()

void        gwy_graph_model_add_curve       (GwyGraphModel *gmodel,
                                             GwyGraphCurveModel *curve);

Adds a new curve to the model. All the curve parameters should be specified within the curve structure.

gmodel : A GwyGraphModel.
curve : A GwyGraphCurveModel representing the curve to add.

gwy_graph_model_remove_curve_by_description ()

gint        gwy_graph_model_remove_curve_by_description
                                            (GwyGraphModel *gmodel,
                                             const gchar *description);

Removes all the curves having same description string as description.

gmodel : A GwyGraphModel.
description : curve description (label)
Returns : The number of removed curves.

gwy_graph_model_remove_curve_by_index ()

void        gwy_graph_model_remove_curve_by_index
                                            (GwyGraphModel *gmodel,
                                             gint cindex);

Removes the curve having given index.

gmodel : A GwyGraphModel.
cindex : Curve index in graph model.

gwy_graph_model_get_curve_by_description ()

GwyGraphCurveModel* gwy_graph_model_get_curve_by_description
                                            (GwyGraphModel *gmodel,
                                             const gchar *description);

gmodel : A GwyGraphModel.
description : curve description (label)
Returns : First curve that has description (label) given by description. Do not free the curve model, it is associated with graph model.

gwy_graph_model_get_curve_by_index ()

GwyGraphCurveModel* gwy_graph_model_get_curve_by_index
                                            (GwyGraphModel *gmodel,
                                             gint cindex);

gmodel : A GwyGraphModel.
cindex : Curve index in graph model.
Returns : Curve with given index. Do not free the curve model. It's associated with the graph model.

gwy_graph_model_remove_all_curves ()

void        gwy_graph_model_remove_all_curves
                                            (GwyGraphModel *gmodel);

Removes all the curves from graph model

gmodel : A GwyGraphModel.

gwy_graph_model_set_title ()

void        gwy_graph_model_set_title       (GwyGraphModel *model,
                                             const gchar *title);

Sets new title for the graph model. title is duplicated.

model : A GwyGraphModel.
title : A new graphmodel title.

gwy_graph_model_set_label_position ()

void        gwy_graph_model_set_label_position
                                            (GwyGraphModel *model,
                                             GwyGraphLabelPosition position);

Sets label (curve desriptions) postion on graph widget.

model : A GwyGraphModel.
position : A new graphmodel label position.

gwy_graph_model_set_label_has_frame ()

void        gwy_graph_model_set_label_has_frame
                                            (GwyGraphModel *model,
                                             gboolean label_has_frame);

Sets whether graph label widget should have a frame around it. Note that the label must be visible (see #gwy_graph_model_set_label_visible()) to see label.

model : A GwyGraphModel.
label_has_frame : label frame mode.

gwy_graph_model_set_label_frame_thickness ()

void        gwy_graph_model_set_label_frame_thickness
                                            (GwyGraphModel *model,
                                             gint thickness);

Sets the label frame thickness. Note that both the frame and label must be visible (see #gwy_graph_model_set_label_visible()) to see label and label frame.

model : A GwyGraphModel.
thickness : Label frame thickness (in pixels).

gwy_graph_model_set_label_reverse ()

void        gwy_graph_model_set_label_reverse
                                            (GwyGraphModel *model,
                                             gboolean reverse);

Sets the label alignment (curve samples and their description postion). By setting the reverse = TRUE you get alignment ("text", "sample"), otherwise you get alignment ("sample", "text").

model : A GwyGraphModel.
reverse : Label alingment mode.

gwy_graph_model_set_label_visible ()

void        gwy_graph_model_set_label_visible
                                            (GwyGraphModel *model,
                                             gboolean visible);

Sets the graph widget label visibility.

model : A GwyGraphModel.
visible : Label visibility.

gwy_graph_model_set_si_unit_x ()

void        gwy_graph_model_set_si_unit_x   (GwyGraphModel *model,
                                             GwySIUnit *siunit);

Sets the physical unit for graph x axis. The unit is duplicated, so you are responsible for freeing siunit.

model : A GwyGraphModel.
siunit : physical unit for x axis

gwy_graph_model_set_si_unit_y ()

void        gwy_graph_model_set_si_unit_y   (GwyGraphModel *model,
                                             GwySIUnit *siunit);

Sets the physical unit for graph y axis. The unit is duplicated, so you are responsible for freeing siunit.

model : A GwyGraphModel.
siunit : physical unit for y axis

gwy_graph_model_set_units_from_data_line ()

void        gwy_graph_model_set_units_from_data_line
                                            (GwyGraphModel *model,
                                             GwyDataLine *data_line);

Sets x and y graph model units to match a data line.

model : A graph model.
data_line : A data line to take units from.

gwy_graph_model_get_title ()

const gchar* gwy_graph_model_get_title      (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : graph title.

gwy_graph_model_get_label_position ()

GwyGraphLabelPosition gwy_graph_model_get_label_position
                                            (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : graph widget label position.

gwy_graph_model_get_label_has_frame ()

gboolean    gwy_graph_model_get_label_has_frame
                                            (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : graph widget label frame visibility.

gwy_graph_model_get_label_frame_thickness ()

gint        gwy_graph_model_get_label_frame_thickness
                                            (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : graph widget label frame thickness.

gwy_graph_model_get_label_reverse ()

gboolean    gwy_graph_model_get_label_reverse
                                            (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : graph widget label alignment mode.

gwy_graph_model_get_label_visible ()

gboolean    gwy_graph_model_get_label_visible
                                            (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : graph widget label visibility.

gwy_graph_model_get_si_unit_x ()

GwySIUnit*  gwy_graph_model_get_si_unit_x   (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : A GwySIUnit containing the physical unit of the x-axis of model. (Do not free).

gwy_graph_model_get_si_unit_y ()

GwySIUnit*  gwy_graph_model_get_si_unit_y   (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : A GwySIUnit containing the physical unit of the y-axis of model. (Do not free).

gwy_graph_model_export_ascii ()

GString*    gwy_graph_model_export_ascii    (GwyGraphModel *model,
                                             const gchar *filename,
                                             gboolean export_units,
                                             gboolean export_labels,
                                             gboolean export_metadata,
                                             GwyGraphModelExportStyle export_style,
                                             GString *string);

Exports graph model into a file. The export format is specified by parameter export_style.

model : A GwyGraphModel.
filename : name of file to be created
export_units : export units in the column header
export_labels : export labels in the column header
export_metadata : export all graph metadata within file header
export_style : specifies the file format to export to (e. g. plain, csv, gnuplot, etc.)
string :
Returns :

gwy_graph_model_signal_layout_changed ()

void        gwy_graph_model_signal_layout_changed
                                            (GwyGraphModel *model);

Emits signal that something general in graph layout (label settings) was changed. Graph widget or other widgets connected to graph model object should react somehow.

model : A GwyGraphModel.

gwy_graph_model_set_direction_logarithmic ()

void        gwy_graph_model_set_direction_logarithmic
                                            (GwyGraphModel *model,
                                             GtkOrientation direction,
                                             gboolean is_logarithmic);

Sets data along the axis specified by direction to display either logarithmically (is_logarithmic=TRUE) or normally (is_logarithmic=FALSE).

model : a GwyGraphModel.
direction : axis orientation (e. g. horizontal, vertical).
is_logarithmic : the logarithmic mode

gwy_graph_model_get_direction_logarithmic ()

gboolean    gwy_graph_model_get_direction_logarithmic
                                            (GwyGraphModel *model,
                                             GtkOrientation direction);

model : a GwyGraphModel.
direction : axis orientation (e. g. horizontal, vertical).
Returns : TRUE if the axis specified by direction is currently set to display logarithmically. FALSE if it is set to display normally.

gwy_graph_model_x_data_can_be_logarithmed ()

gboolean    gwy_graph_model_x_data_can_be_logarithmed
                                            (GwyGraphModel *model);

model : a GwyGraphModel.
Returns : TRUE if all x-values are greater than zero (thus logarithmic display of x-data is safe).

gwy_graph_model_y_data_can_be_logarithmed ()

gboolean    gwy_graph_model_y_data_can_be_logarithmed
                                            (GwyGraphModel *model);

model : a GwyGraphModel.
Returns : TRUE if all y-values are greater than zero (thus logarithmic display of y-data is safe).

Properties

The "n" property

  "n"                    gint                  : Read

Changed number of curves in graph.

Allowed values: [0,100]

Default value: 0


The "title" property

  "title"                gchararray            : Read / Write

Changed title of graph.

Default value: "new graph"

Signals

The "layout-updated" signal

void        user_function                  (GwyGraphModel *gwygraphmodel,
                                            gpointer user_data);

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