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);
gint        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    (GwyGraphModel *gmodel,
                                             gint cindex);
GwyGraphCurveModel* gwy_graph_model_get_curve_by_description
                                            (GwyGraphModel *gmodel,
                                             const gchar *description);
GwyGraphCurveModel* gwy_graph_model_get_curve
                                            (GwyGraphModel *gmodel,
                                             gint cindex);
gint        gwy_graph_model_get_curve_index (GwyGraphModel *gmodel,
                                             GwyGraphCurveModel *curve);
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);
const gchar* gwy_graph_model_get_axis_label (GwyGraphModel *model,
                                             GtkPositionType pos);
void        gwy_graph_model_set_axis_label  (GwyGraphModel *model,
                                             GtkPositionType pos,
                                             const gchar *label);
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);
gdouble     gwy_graph_model_get_xmin        (GwyGraphModel *model);
gdouble     gwy_graph_model_get_xmax        (GwyGraphModel *model);
gdouble     gwy_graph_model_get_ymin        (GwyGraphModel *model);
gdouble     gwy_graph_model_get_ymax        (GwyGraphModel *model);
void        gwy_graph_model_set_xmin        (GwyGraphModel *model,
                                             gdouble value);
void        gwy_graph_model_set_xmax        (GwyGraphModel *model,
                                             gdouble value);
void        gwy_graph_model_set_ymin        (GwyGraphModel *model,
                                             gdouble value);
void        gwy_graph_model_set_ymax        (GwyGraphModel *model,
                                             gdouble value);

Object Hierarchy


  GObject
   +----GwyGraphModel

Implemented Interfaces

GwyGraphModel implements GwySerializable.

Properties


  "axis-label-bottom"    gchararray            : Read / Write
  "axis-label-left"      gchararray            : Read / Write
  "axis-label-right"     gchararray            : Read / Write
  "axis-label-top"       gchararray            : Read / Write
  "n-curves"             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 graph model.
Returns : New graph model.

gwy_graph_model_get_n_curves ()

gint        gwy_graph_model_get_n_curves    (GwyGraphModel *gmodel);

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

gwy_graph_model_add_curve ()

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

Adds a new curve to a graph model.

gmodel : A graph model.
curve : A GwyGraphCurveModel representing the curve to add.
Returns : The index of the added curve in gmodel.

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 graph model.
description : Curve description (label).
Returns : The number of removed curves.

gwy_graph_model_remove_curve ()

void        gwy_graph_model_remove_curve    (GwyGraphModel *gmodel,
                                             gint cindex);

Removes the curve having given index.

gmodel : A graph model.
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 graph model.
description : Curve description (label).
Returns : The first curve that has description (label) given by description (no reference is added).

gwy_graph_model_get_curve ()

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

Gets a graph model curve by its index.

gmodel : A graph model.
cindex : Curve index in graph model.
Returns : The curve with index cindex (no reference is added).

gwy_graph_model_get_curve_index ()

gint        gwy_graph_model_get_curve_index (GwyGraphModel *gmodel,
                                             GwyGraphCurveModel *curve);

Finds the index of a graph model curve.

gmodel : A graph mode.
curve : A curve model present in gmodel to find.
Returns : The index of curve in gmodel, -1 if it is not present there.

gwy_graph_model_remove_all_curves ()

void        gwy_graph_model_remove_all_curves
                                            (GwyGraphModel *gmodel);

Removes all the curves from graph model

gmodel : A graph model.

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 graph model.
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 graph model.
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 graph model.
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 graph model.
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 graph model.
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 graph model.
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 graph model.
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 graph model.
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 graph model.
Returns : graph title.

gwy_graph_model_get_label_position ()

GwyGraphLabelPosition gwy_graph_model_get_label_position
                                            (GwyGraphModel *model);

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

gwy_graph_model_get_label_has_frame ()

gboolean    gwy_graph_model_get_label_has_frame
                                            (GwyGraphModel *model);

model : A graph model.
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 graph model.
Returns : graph widget label frame thickness.

gwy_graph_model_get_label_reverse ()

gboolean    gwy_graph_model_get_label_reverse
                                            (GwyGraphModel *model);

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

gwy_graph_model_get_label_visible ()

gboolean    gwy_graph_model_get_label_visible
                                            (GwyGraphModel *model);

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

gwy_graph_model_get_si_unit_x ()

GwySIUnit*  gwy_graph_model_get_si_unit_x   (GwyGraphModel *model);

model : A graph model.
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 graph model.
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 graph model.
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_get_axis_label ()

const gchar* gwy_graph_model_get_axis_label (GwyGraphModel *model,
                                             GtkPositionType pos);

Gets the label of a one graph model axis.

model : A graph model.
pos : Axis position.
Returns : The label as a string owned by the model.

gwy_graph_model_set_axis_label ()

void        gwy_graph_model_set_axis_label  (GwyGraphModel *model,
                                             GtkPositionType pos,
                                             const gchar *label);

Sets one axis label of a graph model.

model : A graph model.
pos : Axis position.
label : The new label.

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 graph model.
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 graph model.
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 graph model.
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 graph model.
Returns : TRUE if all y-values are greater than zero (thus logarithmic display of y-data is safe).

gwy_graph_model_get_xmin ()

gdouble     gwy_graph_model_get_xmin        (GwyGraphModel *model);

Returns bounding value for all the curves within model. This value is recomputed while adding curves to the graph depending on actual graph settings.

model : A graph model.
Returns : x minimum bounding value of the curves

gwy_graph_model_get_xmax ()

gdouble     gwy_graph_model_get_xmax        (GwyGraphModel *model);

Returns bounding value for all the curves within model. This value is recomputed while adding curves to the graph depending on actual graph settings.

model : A graph model.
Returns : x maximum bounding value of the curves

gwy_graph_model_get_ymin ()

gdouble     gwy_graph_model_get_ymin        (GwyGraphModel *model);

Returns bounding value for all the curves within model. This value is recomputed while adding curves to the graph depending on actual graph settings.

model : A graph model.
Returns : y minimum bounding value of the curves

gwy_graph_model_get_ymax ()

gdouble     gwy_graph_model_get_ymax        (GwyGraphModel *model);

Returns bounding value for all the curves within model. This value is recomputed while adding curves to the graph depending on actual graph settings.

model : A graph model.
Returns : y maximum bounding value of the curves

gwy_graph_model_set_xmin ()

void        gwy_graph_model_set_xmin        (GwyGraphModel *model,
                                             gdouble value);

Sets bounding value for all the curves within model. This value is recomputed while adding curves to the graph depending on actual graph settings.

model : A graph model.
value :

gwy_graph_model_set_xmax ()

void        gwy_graph_model_set_xmax        (GwyGraphModel *model,
                                             gdouble value);

Sets bounding value for all the curves within model. This value is recomputed while adding curves to the graph depending on actual graph settings.

model : A graph model.
value :

gwy_graph_model_set_ymin ()

void        gwy_graph_model_set_ymin        (GwyGraphModel *model,
                                             gdouble value);

Sets bounding value for all the curves within model. This value is recomputed while adding curves to the graph depending on actual graph settings.

model : A graph model.
value :

gwy_graph_model_set_ymax ()

void        gwy_graph_model_set_ymax        (GwyGraphModel *model,
                                             gdouble value);

Sets bounding value for all the curves within model. This value is recomputed while adding curves to the graph depending on actual graph settings.

model : A graph model.
value :

Properties

The "axis-label-bottom" property

  "axis-label-bottom"    gchararray            : Read / Write

The label of the bottom axis.

Default value: "x"


The "axis-label-left" property

  "axis-label-left"      gchararray            : Read / Write

The label of the left axis.

Default value: "y"


The "axis-label-right" property

  "axis-label-right"     gchararray            : Read / Write

The label of the right axis.

Default value: ""


The "axis-label-top" property

  "axis-label-top"       gchararray            : Read / Write

The label of the top axis.

Default value: ""


The "n-curves" property

  "n-curves"             gint                  : Read

The number of curves in graph model.

Allowed values: [0,100]

Default value: 0


The "title" property

  "title"                gchararray            : Read / Write

The graph title.

Default value: "New graph"

Signals

The "layout-updated" signal

void        user_function                  (GwyGraphModel *gwygraphmodel,
                                            gpointer user_data);

XXX XXX XXX: This bloody signal is emitted whenever anything in the bloody graph changes instead of making the bloody graph model properties real properties and emitting property change notification.

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