GwyGraphArea

GwyGraphArea — Layout for drawing graph curves

Functions

Properties

GwyGraphStatusType status Read / Write

Signals

void edit-curve Action

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBin
                    ╰── GwyGraphArea

Implemented Interfaces

GwyGraphArea implements AtkImplementorIface and GtkBuildable.

Includes

#include <libgwydgets/gwydgets.h>

Description

GwyGraphArea is the central part of GwyGraph widget. It plots a set of data curves with the given plot properties.

It is recommended to use it within GwyGraph. However, it can also be used separately.

Functions

gwy_graph_area_new()

GtkWidget *
gwy_graph_area_new (void);

Creates a new graph area widget.

Returns

Newly created graph area as GtkWidget.


gwy_graph_area_set_model()

void
gwy_graph_area_set_model (GwyGraphArea *area,
                          GwyGraphModel *gmodel);

Sets the graph model of a graph area.

Parameters

area

A graph area.

 

gmodel

New graph model.

 

gwy_graph_area_get_model()

GwyGraphModel *
gwy_graph_area_get_model (GwyGraphArea *area);

Gets the model of a graph area.

Parameters

area

A graph area.

 

Returns

The graph model this graph area widget displays.


gwy_graph_area_set_x_range()

void
gwy_graph_area_set_x_range (GwyGraphArea *area,
                            gdouble x_min,
                            gdouble x_max);

Sets the horizontal range a graph area displays.

Parameters

area

A graph area.

 

x_min

The minimum x value, in real coodrinates.

 

x_max

The maximum x value, in real coodrinates.

 

gwy_graph_area_set_y_range()

void
gwy_graph_area_set_y_range (GwyGraphArea *area,
                            gdouble y_min,
                            gdouble y_max);

Sets the vertical range a graph area displays.

Parameters

area

A graph area.

 

y_min

The minimum y value, in real coodrinates.

 

y_max

The maximum y value, in real coodrinates.

 

gwy_graph_area_set_x_grid_data()

void
gwy_graph_area_set_x_grid_data (GwyGraphArea *area,
                                guint ndata,
                                const gdouble *grid_data);

Sets the grid data on the x-axis of a graph area

Parameters

area

A graph area.

 

ndata

The number of points in grid_data .

 

grid_data

Array of grid line positions on the x-axis (in real values, not pixels).

 

gwy_graph_area_set_y_grid_data()

void
gwy_graph_area_set_y_grid_data (GwyGraphArea *area,
                                guint ndata,
                                const gdouble *grid_data);

Sets the grid data on the y-axis of a graph area

Parameters

area

A graph area.

 

ndata

The number of points in grid_data .

 

grid_data

Array of grid line positions on the y-axis (in real values, not pixels).

 

gwy_graph_area_get_x_grid_data()

const gdouble *
gwy_graph_area_get_x_grid_data (GwyGraphArea *area,
                                guint *ndata);

Gets the grid data on the x-axis of a graph area.

Parameters

area

A graph area.

 

ndata

Location to store the number of returned positions.

 

Returns

Array of grid line positions (in real values, not pixels) owned by the graph area.


gwy_graph_area_get_y_grid_data()

const gdouble *
gwy_graph_area_get_y_grid_data (GwyGraphArea *area,
                                guint *ndata);

Gets the grid data on the y-axis of a graph area.

Parameters

area

A graph area.

 

ndata

Location to store the number of returned positions.

 

Returns

Array of grid line positions (in real values, not pixels) owned by the graph area.


gwy_graph_area_get_selection()

GwySelection *
gwy_graph_area_get_selection (GwyGraphArea *area,
                              GwyGraphStatusType status);

Gets the selection object corresponding to a status of a graph area.

A selection object exists even for inactive status types (selection modes), therefore also selections for other modes than the currently active one can be requested.

The selection type is GwySelectionAxis for point-wise selections along axes GWY_GRAPH_STATUS_XLINES and GWY_GRAPH_STATUS_YLINES.

The selection type is GwySelectionRange for range selections along axes GWY_GRAPH_STATUS_XSEL and GWY_GRAPH_STATUS_YSEL.

The selection type is GwySelectionPoint for the point-wise selection GWY_GRAPH_STATUS_POINTS.

The selection type is GwySelectionRectangle for the zoom mode GWY_GRAPH_STATUS_ZOOM (which is generally handled internally by the graph).

Parameters

area

A graph area.

 

status

Graph status. Passing GWY_GRAPH_STATUS_PLAIN mode (which has no selection associated) can be used to obtain the selection for the current mode.

 

Returns

The requested selection. It is NULL only if status is GWY_GRAPH_STATUS_PLAIN and the current selection mode is GWY_GRAPH_STATUS_PLAIN.


gwy_graph_area_set_status()

void
gwy_graph_area_set_status (GwyGraphArea *area,
                           GwyGraphStatusType status);

Sets the status of a graph area.

When the area is inside a GwyGraph, use gwy_graph_set_status() instead (also see this function for details).

Parameters

area

A graph area.

 

status

New graph area status.

 

gwy_graph_area_get_status()

GwyGraphStatusType
gwy_graph_area_get_status (GwyGraphArea *area);

Gets the status of a grap area.

See gwy_graph_area_set_status().

Parameters

area

A graph area.

 

Returns

The current graph area status.


gwy_graph_area_enable_user_input()

void
gwy_graph_area_enable_user_input (GwyGraphArea *area,
                                  gboolean enable);

Enables/disables auxiliary graph area dialogs (invoked by clicking the mouse).

Note, however, that this setting does not control editability of selections. Use gwy_graph_area_set_selection_editable() for that.

Parameters

area

A graph area.

 

enable

TRUE to enable user interaction, FALSE to disable it.

 

gwy_graph_area_set_selection_editable()

void
gwy_graph_area_set_selection_editable (GwyGraphArea *area,
                                       gboolean setting);

Enables/disables selection editing using mouse.

When selection editing is disabled the graph area status type determines the selection type that can be drawn on the area. However, the user cannot modify it.

Parameters

area

A graph area.

 

setting

TRUE to enable selection editing, FALSE to disable it.

 

gwy_graph_area_edit_curve()

void
gwy_graph_area_edit_curve (GwyGraphArea *area,
                           gint id);

Invokes the curve property dialog for a curve plotted in a graph area.

If the dialog is already displayed, it is switched to the requested curve.

Parameters

area

A graph area.

 

id

The index of the curve to edit properties of.

 

gwy_graph_area_coords_widget_to_real()

void
gwy_graph_area_coords_widget_to_real (GwyGraphArea *area,
                                      gdouble xscr,
                                      gdouble yscr,
                                      gdouble *x,
                                      gdouble *y);

gwy_graph_area_set_natural_size()

void
gwy_graph_area_set_natural_size (GwyGraphArea *area,
                                 gint width,
                                 gint height);

Sets the preferred natural dimensions of a graph area.

Graphs can be very small, but have relatively large default (natural) dimensions. Since GTK+ tries to make windows large enough for the natural widget sizes, it does not work well when they are used as small preview plots in dialogs. This function allows setting the natural size arbitrarily.

The minimum size is not changed (and is very small by default). Use gtk_widget_set_size_request() to set a minimum size.

Parameters

area

A graph area.

 

width

Natural width the graph area should prefer, or a negative value to use the default.

 

height

Natural height the area graph should prefer, or a negative value to use the default.

 

Types and Values

enum GwyGraphLabelPosition

Members

GWY_GRAPH_LABEL_NORTHEAST

   

GWY_GRAPH_LABEL_NORTHWEST

   

GWY_GRAPH_LABEL_SOUTHEAST

   

GWY_GRAPH_LABEL_SOUTHWEST

   

GWY_GRAPH_LABEL_USER

   

enum GwyGraphStatusType

Members

GWY_GRAPH_STATUS_PLAIN

   

GWY_GRAPH_STATUS_XSEL

   

GWY_GRAPH_STATUS_YSEL

   

GWY_GRAPH_STATUS_XLINES

   

GWY_GRAPH_STATUS_YLINES

   

GWY_GRAPH_STATUS_POINTS

   

GWY_GRAPH_STATUS_ZOOM

   

struct GwyGraphArea

struct GwyGraphArea;

struct GwyGraphAreaClass

struct GwyGraphAreaClass {
    GtkBinClass parent_class;

    void (*edit_curve)(GwyGraphArea *area,
                       gint id);

    void (*reserved1)(void);
    void (*reserved2)(void);
};

Property Details

The “status” property

  “status”                   GwyGraphStatusType

The type of reaction to mouse events (zoom, selections).

Owner: GwyGraphArea

Flags: Read / Write

Default value: GWY_GRAPH_STATUS_PLAIN

Signal Details

The “edit-curve” signal

void
user_function (GwyGraphArea *gwygraphcurvemodel,
               int           arg1,
               gpointer      user_data)

The ::data-changed signal is emitted when a curve properties are to be edited.

Parameters

gwygraphcurvemodel

The GwyGraphArea which received the signal.

 

arg1

The index of the curve to edit.

 

user_data

user data set when the signal handler was connected.

 

Flags: Action