GwyGraphAxis

GwyGraphAxis — Axis with ticks and labels

Functions

Properties

gboolean auto Read / Write
char * label Read / Write
int major-length Read / Write
int major-maxticks Read / Write
int major-thickness Read / Write
int minor-division Read / Write
int minor-length Read / Write
int minor-thickness Read / Write

Signals

void rescaled Run First

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GwyGraphAxis

Implemented Interfaces

GwyGraphAxis implements AtkImplementorIface and GtkBuildable.

Includes

#include <libgwydgets/gwydgets.h>

Description

GwyGraphAxis is used for drawing axis. It is namely used within GwyGraph widget, but it can be also used standalone. It plots a horizontal or vertical axis with major and minor ticks, with ranges in the requested interval.

Functions

gwy_graph_axis_new()

GtkWidget *
gwy_graph_axis_new (GtkPositionType position);

Creates a new axis.

Parameters

position

Axis position (implying orientation).

 

Returns

New axis as a GtkWidget.


gwy_graph_axis_set_logarithmic()

void
gwy_graph_axis_set_logarithmic (GwyGraphAxis *axis,
                                gboolean is_logarithmic);

Sets logarithmic mode.

Parameters

axis

graph axis

 

is_logarithmic

logarithmic mode

 

gwy_graph_axis_is_logarithmic()

gboolean
gwy_graph_axis_is_logarithmic (GwyGraphAxis *axis);

Determines whether axis is set to be locarithmic.

Parameters

axis

An axis.

 

Returns

TRUE if axis is logarithmic.


gwy_graph_axis_get_position()

GtkPositionType
gwy_graph_axis_get_position (GwyGraphAxis *axis);

Gets the position of an axis.

Parameters

axis

An axis.

 

Returns

The position.


gwy_graph_axis_set_auto()

void
gwy_graph_axis_set_auto (GwyGraphAxis *axis,
                         gboolean is_auto);

Enables or disables automatic axis adjustmet.

Parameters

axis

An axis.

 

is_auto

TRUE to enable automatic tick size and distribution adjustment, FALSE to disable it.

 

gwy_graph_axis_request_range()

void
gwy_graph_axis_request_range (GwyGraphAxis *axis,
                              gdouble min,
                              gdouble max);

Sets the requisition of axis boundaries.

The axis will adjust the boundaries to satisfy requisition but still have reasonable tick values and spacing. Use gwy_graph_axis_get_range() to obtain the boundaries the axis actually decided to use.

Parameters

axis

An axis.

 

min

Minimum requisition (min boundary value).

 

max

Maximum requisition (max boundary value).

 

gwy_graph_axis_get_range()

void
gwy_graph_axis_get_range (GwyGraphAxis *axis,
                          gdouble *min,
                          gdouble *max);

Gets the actual boundaries of an axis.

Parameters

axis

An axis.

 

min

Location to store actual axis minimum, or NULL.

 

max

Location to store actual axis maximum, or NULL.

 

gwy_graph_axis_get_requested_range()

void
gwy_graph_axis_get_requested_range (GwyGraphAxis *axis,
                                    gdouble *min,
                                    gdouble *max);

Gets the requested boundaries of an axis.

Parameters

axis

An axis.

 

min

Location to store requested axis minimum, or NULL.

 

max

Location to store requested axis maximum, or NULL.

 

gwy_graph_axis_get_magnification()

gdouble
gwy_graph_axis_get_magnification (GwyGraphAxis *axis);

Gets the magnification value of a graph axis.

Parameters

axis

Axis widget

 

Returns

Magnification value of the axis.


gwy_graph_axis_get_magnification_string()

const gchar *
gwy_graph_axis_get_magnification_string
                               (GwyGraphAxis *axis);

Gets the magnification string of an axis.

Parameters

axis

An axis.

 

Returns

Magnification string of the axis, owned by the axis.


gwy_graph_axis_set_label()

void
gwy_graph_axis_set_label (GwyGraphAxis *axis,
                          const gchar *label);

Sets the label text of an axis.

Parameters

axis

An axis.

 

label

The new label text (it can be NULL for an empty label).

 

gwy_graph_axis_get_label()

const gchar *
gwy_graph_axis_get_label (GwyGraphAxis *axis);

Gets the label of an axis.

Parameters

axis

An axis.

 

Returns

Axis label as a string owned by axis .


gwy_graph_axis_get_si_unit()

GwySIUnit *
gwy_graph_axis_get_si_unit (GwyGraphAxis *axis);

Obtains the axis unit.

Parameters

axis

An axis.

 

gwy_graph_axis_set_si_unit()

void
gwy_graph_axis_set_si_unit (GwyGraphAxis *axis,
                            GwySIUnit *unit);

Sets the axis unit.

This will be appended automatically to the label.

Parameters

axis

An axis.

 

unit

axis unit

 

gwy_graph_axis_enable_label_edit()

void
gwy_graph_axis_enable_label_edit (GwyGraphAxis *axis,
                                  gboolean enable);

Enables/disables user to change axis label by clicking on axis widget.

Parameters

axis

Axis widget

 

enable

enable/disable user to change axis label

 

gwy_graph_axis_get_major_ticks()

gdouble *
gwy_graph_axis_get_major_ticks (GwyGraphAxis *axis,
                                guint *nticks);

Gets the positions of major ticks of an axis.

Parameters

axis

An axis.

 

nticks

Location to store the number of returned ticks.

 

Returns

A newly allocated array with the positions of axis major ticks (as real values, not pixels).

Types and Values

struct GwyGraphAxis

struct GwyGraphAxis;

struct GwyGraphAxisClass

struct GwyGraphAxisClass {
    GtkWidgetClass parent_class;

    void (*rescaled)(GwyGraphAxis *axis);

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

Property Details

The “auto” property

  “auto”                     gboolean

Autoscale ticks with changing content.

Owner: GwyGraphAxis

Flags: Read / Write

Default value: TRUE


The “label” property

  “label”                    char *

Axis label (without units).

Owner: GwyGraphAxis

Flags: Read / Write

Default value: ""


The “major-length” property

  “major-length”             int

Major ticks length.

Owner: GwyGraphAxis

Flags: Read / Write

Allowed values: [0,20]

Default value: 5


The “major-maxticks” property

  “major-maxticks”           int

Major ticks maximum number.

Owner: GwyGraphAxis

Flags: Read / Write

Allowed values: [0,50]

Default value: 5


The “major-thickness” property

  “major-thickness”          int

Major ticks thickness.

Owner: GwyGraphAxis

Flags: Read / Write

Allowed values: [0,20]

Default value: 5


The “minor-division” property

  “minor-division”           int

Minor ticks division.

Owner: GwyGraphAxis

Flags: Read / Write

Allowed values: [0,20]

Default value: 5


The “minor-length” property

  “minor-length”             int

Minor ticks length.

Owner: GwyGraphAxis

Flags: Read / Write

Allowed values: [0,20]

Default value: 5


The “minor-thickness” property

  “minor-thickness”          int

Minor ticks thickness.

Owner: GwyGraphAxis

Flags: Read / Write

Allowed values: [0,20]

Default value: 5

Signal Details

The “rescaled” signal

void
user_function (GwyGraphAxis *gwygraphaxis,
               gpointer      user_data)

Flags: Run First

See Also

GwyColorAxis -- Axis with a false color scale, GwyRuler -- Horizontal and vertical rulers