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);
void        gwy_graph_model_remove_curve_by_description
                                            (GwyGraphModel *gmodel,
                                             gchar *description);
void        gwy_graph_model_remove_curve_by_index
                                            (GwyGraphModel *gmodel,
                                             gint cindex);
GwyGraphCurveModel* gwy_graph_model_get_curve_by_description
                                            (GwyGraphModel *gmodel,
                                             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,
                                             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_x_siunit    (GwyGraphModel *model,
                                             GwySIUnit *siunit);
void        gwy_graph_model_set_y_siunit    (GwyGraphModel *model,
                                             GwySIUnit *siunit);
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_x_siunit    (GwyGraphModel *model);
GwySIUnit*  gwy_graph_model_get_y_siunit    (GwyGraphModel *model);
void        gwy_graph_model_export_ascii    (GwyGraphModel *model,
                                             const gchar *filename,
                                             gboolean export_units,
                                             gboolean export_labels,
                                             gboolean export_metadata,
                                             GwyGraphModelExportStyle export_style);
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. It will be meaningfully used by the new generation of graph widgets and should be mostly ignored for now.

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. The curve is duplicated to put data inside model, therefore it should be freed by user when not necessary.

gmodel : A GwyGraphModel.
curve : A GwyGraphCurveModel representing curve.

gwy_graph_model_remove_curve_by_description ()

void        gwy_graph_model_remove_curve_by_description
                                            (GwyGraphModel *gmodel,
                                             gchar *description);

gmodel :
description :

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 (within GwyGraphModel structure)

gwy_graph_model_get_curve_by_description ()

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

gmodel :
description :
Returns :

gwy_graph_model_get_curve_by_index ()

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

gmodel :
cindex :
Returns :

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,
                                             gchar *title);

Sets new title for the graph model.

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 widget label should have frame around. 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 the 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 alingment (curve samples and their description postion). By setting the reverse = TRUE you get alingment ("text", "sample"), otherwise you get alingment ("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_x_siunit ()

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

Sets the physical unit for graph x axis

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

gwy_graph_model_set_y_siunit ()

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

Sets the physical unit for graph y axis

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

gwy_graph_model_get_title ()

gchar*      gwy_graph_model_get_title       (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : graph title (newly allocated string).

gwy_graph_model_get_label_position ()

GwyGraphLabelPosition gwy_graph_model_get_label_position
                                            (GwyGraphModel *model);

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

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 alingment 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_x_siunit ()

GwySIUnit*  gwy_graph_model_get_x_siunit    (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : physical unit for graph x axis

gwy_graph_model_get_y_siunit ()

GwySIUnit*  gwy_graph_model_get_y_siunit    (GwyGraphModel *model);

model : A GwyGraphModel.
Returns : physical unit for graph y axis

gwy_graph_model_export_ascii ()

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

Exports graph model into a file. The export options are 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 : style of values export to be readable by cetain program directly.

gwy_graph_model_signal_layout_changed ()

void        gwy_graph_model_signal_layout_changed
                                            (GwyGraphModel *model);

Emits signal that somehing 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);

model :
direction :
is_logarithmic :

gwy_graph_model_get_direction_logarithmic ()

gboolean    gwy_graph_model_get_direction_logarithmic
                                            (GwyGraphModel *model,
                                             GtkOrientation direction);

model :
direction :
Returns :

gwy_graph_model_x_data_can_be_logarithmed ()

gboolean    gwy_graph_model_x_data_can_be_logarithmed
                                            (GwyGraphModel *model);

model :
Returns :

gwy_graph_model_y_data_can_be_logarithmed ()

gboolean    gwy_graph_model_y_data_can_be_logarithmed
                                            (GwyGraphModel *model);

model :
Returns :

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.