PocAxis

PocAxis — Axis gadget for PocPlot

Functions

Properties

GtkAdjustment * adjustment Read / Write
gboolean auto-interval Read / Write
PocAxisMode axis-mode Read / Write
gfloat label-size Read / Write
gchar * legend Read / Write
gfloat legend-size Read / Write
gdouble lower-bound Read / Write
PocLineStyle major-grid Read / Write
gdouble major-interval Read / Write
guint minor-divisions Read / Write
PocLineStyle minor-grid Read / Write
gfloat tick-size Read / Write
gdouble upper-bound Read / Write

Signals

Types and Values

#define POC_TYPE_AXIS
struct PocAxisClass
  PocAxis

Object Hierarchy

    GObject
    ╰── PocAxis

Includes

#include <poc.h>

Description

Each dataset added to a plot requires an X and Y axis. Several datasets may share axes. An axis controls the upper and lower bounds and the displayed portion of the plot data. If an axis is configured using a GtkAdjustment it may display a portion of its full range under control of the adjustment, otherwise it shows the full range between its lower and upper bounds.

Although axes contain drawing code, drawing always takes place under control of the PocPlot and on its canvas. Axes are vertical or horizontally orientated and are drawn at the appropriate edge of the plot depending on the associated dataset and plot surface. It is possible for the same axis to be shared on more than one plot and may be orientated differently on each. Axes are also responsible from drawing grid lines in the main plot area.

Functions

poc_axis_new ()

PocAxis *
poc_axis_new (void);

Create a new PocAxis

Returns

New PocAxis.

[transfer full]


poc_axis_set_axis_mode ()

void
poc_axis_set_axis_mode (PocAxis *self,
                        PocAxisMode axis_mode);

Show axis as linear, octaves or decades.

Parameters

self

A PocAxis

 

axis_mode

A PocAxisMode

 

poc_axis_get_axis_mode ()

PocAxisMode
poc_axis_get_axis_mode (PocAxis *self);

Return the current axis mode.

Parameters

self

A PocAxis

 

Returns

a PocAxisMode


poc_axis_set_lower_bound ()

void
poc_axis_set_lower_bound (PocAxis *self,
                          gdouble bound);

Set lower bound of range to plot on this axis.

Parameters

self

A PocAxis

 

bound

lower bound

 

poc_axis_get_lower_bound ()

gdouble
poc_axis_get_lower_bound (PocAxis *self);

Get the lower bound of the axis range.

Parameters

self

A PocAxis

 

Returns

lower bound


poc_axis_set_upper_bound ()

void
poc_axis_set_upper_bound (PocAxis *self,
                          gdouble bound);

Set upper bound of range to plot on this axis.

Parameters

self

A PocAxis

 

bound

upper bound

 

poc_axis_get_upper_bound ()

gdouble
poc_axis_get_upper_bound (PocAxis *self);

Get the upper bound of the axis range.

Parameters

self

A PocAxis

 

Returns

upper bound


poc_axis_set_adjustment ()

void
poc_axis_set_adjustment (PocAxis *self,
                         GtkAdjustment *adjustment);

Set an adjustment to scroll between bounds on axis.

Parameters

self

A PocAxis

 

adjustment

A GtkAdjustment

 

poc_axis_get_adjustment ()

GtkAdjustment *
poc_axis_get_adjustment (PocAxis *self);

Get the axis adjustment.

Parameters

self

A PocAxis

 

Returns

A GtkAdjustment.

[transfer none]


poc_axis_set_major_interval ()

void
poc_axis_set_major_interval (PocAxis *self,
                             gdouble interval);

Set the major tick interval.

Parameters

self

A PocAxis

 

interval

tick interval

 

poc_axis_get_major_interval ()

gdouble
poc_axis_get_major_interval (PocAxis *self);

Get the major tick interval.

Parameters

self

A PocAxis

 

Returns

interval


poc_axis_set_auto_interval ()

void
poc_axis_set_auto_interval (PocAxis *self,
                            gboolean enabled);

Automatically set major tick interval if enabled is TRUE.

Parameters

self

A PocAxis

 

enabled

enable auto calculation

 

poc_axis_get_auto_interval ()

gboolean
poc_axis_get_auto_interval (PocAxis *self);

Get whether auto calculation of the major interval is enabled.

Parameters

self

A PocAxis

 

Returns

TRUE if enabled


poc_axis_set_minor_divisions ()

void
poc_axis_set_minor_divisions (PocAxis *self,
                              guint divisions);

Minor tick interval on this axis.

Parameters

self

A PocAxis

 

divisions

tick interval

 

poc_axis_get_minor_divisions ()

guint
poc_axis_get_minor_divisions (PocAxis *self);

Get the minor tick interval.

Parameters

self

A PocAxis

 

Returns

interval


poc_axis_set_tick_size ()

void
poc_axis_set_tick_size (PocAxis *self,
                        gfloat size);

Set the tick size on this axis.

Parameters

self

A PocAxis

 

size

tick size

 

poc_axis_get_tick_size ()

gfloat
poc_axis_get_tick_size (PocAxis *self);

Get the tick size.

Parameters

self

A PocAxis

 

Returns

tick size


poc_axis_set_label_size ()

void
poc_axis_set_label_size (PocAxis *self,
                         gfloat size);

Set text size for tick label.

Parameters

self

A PocAxis

 

size

text size

 

poc_axis_get_label_size ()

gfloat
poc_axis_get_label_size (PocAxis *self);

Get text size for the tick label.

Parameters

self

A PocAxis

 

Returns

size


poc_axis_set_major_grid ()

void
poc_axis_set_major_grid (PocAxis *self,
                         PocLineStyle major_grid);

Set the line style for major grid lines.

Parameters

self

A PocAxis

 

major_grid

Requested line style

 

poc_axis_get_major_grid ()

PocLineStyle
poc_axis_get_major_grid (PocAxis *self);

Get the line style for major grid lines.

Parameters

self

A PocAxis

 

Returns

a PocLineStyle


poc_axis_set_minor_grid ()

void
poc_axis_set_minor_grid (PocAxis *self,
                         PocLineStyle minor_grid);

Set the line style for minor grid lines.

Parameters

self

A PocAxis

 

minor_grid

Requested line style

 

poc_axis_get_minor_grid ()

PocLineStyle
poc_axis_get_minor_grid (PocAxis *self);

Get the line style for minor grid lines.

Parameters

self

A PocAxis

 

Returns

a PocLineStyle


poc_axis_set_legend ()

void
poc_axis_set_legend (PocAxis *self,
                     const gchar *legend);

Set the legend text for the axis.

Parameters

self

A PocAxis

 

legend

legend text

 

poc_axis_get_legend ()

const gchar *
poc_axis_get_legend (PocAxis *self);

Get the legend text for the axis.

Parameters

self

A PocAxis

 

Returns

legend text.

[transfer none]


poc_axis_set_legend_size ()

void
poc_axis_set_legend_size (PocAxis *self,
                          gfloat size);

Set text size for the axis legend.

Parameters

self

A PocAxis

 

size

Size for legend text

 

poc_axis_get_legend_size ()

gfloat
poc_axis_get_legend_size (PocAxis *self);

Get text size for the axis legend.

Parameters

self

A PocAxis

 

Returns

text size


poc_axis_notify_update ()

void
poc_axis_notify_update (PocAxis *self);

poc_axis_draw_axis ()

void
poc_axis_draw_axis (PocAxis *self,
                    cairo_t *cr,
                    GtkOrientation orientation,
                    GtkPackType pack,
                    guint width,
                    guint height,
                    GtkStyleContext *style);

Draw plot grid lines in main plot area. Used by PocPlot.

Parameters

self

A PocAxis

 

cr

A cairo_t

 

orientation

A GtkOrientation

 

pack

A GtkPackType

 

width

Plot area width

 

height

Plot area height

 

style

A GtkStyleContext

 

poc_axis_draw_grid ()

void
poc_axis_draw_grid (PocAxis *self,
                    cairo_t *cr,
                    GtkOrientation orientation,
                    guint width,
                    guint height,
                    GtkStyleContext *style);

Draw plot grid lines in main plot area. Used by PocPlot.

Parameters

self

A PocAxis

 

cr

A cairo_t

 

orientation

A GtkOrientation

 

width

Plot area width

 

height

Plot area height

 

style

A GtkStyleContext

 

poc_axis_size ()

gdouble
poc_axis_size (PocAxis *self);

Compute the width or height of the axis on the plot canvas. Used by PocPlot.

Parameters

self

A PocAxis

 

poc_axis_configure ()

void
poc_axis_configure (PocAxis *self,
                    PocAxisMode axis_mode,
                    gdouble lower_bound,
                    gdouble upper_bound);

Set axis parameters in a single call.

Parameters

self

A PocAxis

 

axis_mode

A PocAxisMode

 

lower_bound

axis lower bound

 

upper_bound

axis upper bound

 

poc_axis_get_range ()

void
poc_axis_get_range (PocAxis *self,
                    gdouble *lower_bound,
                    gdouble *upper_bound);

Get full axis range. The visible part of the axis may be less if scrolling.

Parameters

self

A PocAxis

 

lower_bound

axis lower bound

 

upper_bound

axis upper bound

 

poc_axis_get_display_range ()

void
poc_axis_get_display_range (PocAxis *self,
                            gdouble *lower_bound,
                            gdouble *upper_bound);

Get displayed axis range. This may be less than the full range if scrolling.

Parameters

self

A PocAxis

 

lower_bound

axis lower bound

 

upper_bound

axis upper bound

 

poc_axis_linear_project ()

double
poc_axis_linear_project (PocAxis *self,
                         gdouble value,
                         gint norm);

Project a value from the dataset to pixel based position. The value is projected using linear interpolation between the axis limits. This function is intended for use in drawing code in subclasses of PocDataset

Parameters

self

A PocAxis

 

value

value to project

 

norm

normalisation value

 

Returns

projected value


poc_axis_project ()

double
poc_axis_project (PocAxis *self,
                  gdouble value,
                  gint norm);

Project a value from the dataset to pixel based position. The value is interpreted according to the axis mode. This function is intended for use in drawing code in subclasses of PocDataset

Parameters

self

A PocAxis

 

value

value to project

 

norm

normalisation value

 

Returns

projected value

Types and Values

POC_TYPE_AXIS

#define POC_TYPE_AXIS			poc_axis_get_type ()

struct PocAxisClass

struct PocAxisClass {
};

PocAxis

typedef struct _PocAxis PocAxis;

Property Details

The “adjustment” property

  “adjustment”               GtkAdjustment *

Adjustment to scroll between bounds on axis.

Owner: PocAxis

Flags: Read / Write


The “auto-interval” property

  “auto-interval”            gboolean

Automatically set major tick interval.

Owner: PocAxis

Flags: Read / Write

Default value: TRUE


The “axis-mode” property

  “axis-mode”                PocAxisMode

Show axis as linear, octaves or decades.

Owner: PocAxis

Flags: Read / Write

Default value: POC_AXIS_LINEAR


The “label-size” property

  “label-size”               gfloat

Text size for tick label.

Owner: PocAxis

Flags: Read / Write

Allowed values: [2,100]

Default value: 10


The “legend” property

  “legend”                   gchar *

Text for the axis legend.

Owner: PocAxis

Flags: Read / Write

Default value: NULL


The “legend-size” property

  “legend-size”              gfloat

Text size for axis legend.

Owner: PocAxis

Flags: Read / Write

Allowed values: [2,100]

Default value: 14


The “lower-bound” property

  “lower-bound”              gdouble

Lower bound of range to plot on this axis.

Owner: PocAxis

Flags: Read / Write

Allowed values: [-1e+06,1e+06]

Default value: 0


The “major-grid” property

  “major-grid”               PocLineStyle

Line style for major grid lines.

Owner: PocAxis

Flags: Read / Write

Default value: POC_LINE_STYLE_SOLID


The “major-interval” property

  “major-interval”           gdouble

Major tick interval.

Owner: PocAxis

Flags: Read / Write

Allowed values: [0,1e+06]

Default value: 10


The “minor-divisions” property

  “minor-divisions”          guint

Minor tick interval on this axis.

Owner: PocAxis

Flags: Read / Write

Allowed values: [1,100]

Default value: 5


The “minor-grid” property

  “minor-grid”               PocLineStyle

Line style for minor grid lines.

Owner: PocAxis

Flags: Read / Write

Default value: POC_LINE_STYLE_DASH


The “tick-size” property

  “tick-size”                gfloat

Tick size on this axis.

Owner: PocAxis

Flags: Read / Write

Allowed values: [0,100]

Default value: 10


The “upper-bound” property

  “upper-bound”              gdouble

Upper bound of range to plot on this axis.

Owner: PocAxis

Flags: Read / Write

Allowed values: [-1e+06,1e+06]

Default value: 1

Signal Details

The “update” signal

void
user_function (PocAxis *pocaxis,
               gpointer user_data)

Flags: No Hooks

See Also

PocPlot PocDataset