GooCurve2d

GooCurve2d — a curve on a rectangle background (scaled by at least one GooAxis).

Synopsis

struct              GooCurve2d;
struct              GooCurve2dClass;
GooCurve2d *        goo_curve2d_new                     (GooCanvasItem *Parent,
                                                         GooAxis *AxisX,
                                                         GooAxis *AxisY,
                                                         GooDataPoints *Dat,
                                                         ...);
void                goo_curve2d_get_area_properties     (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_get_errors_properties   (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_get_markers_properties  (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_get_perpens_properties  (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_get_vectors_properties  (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_set_area_properties     (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_set_errors_properties   (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_set_markers_properties  (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_set_perpens_properties  (GooCurve2d *Curve2d,
                                                         ...);
void                goo_curve2d_set_vectors_properties  (GooCurve2d *Curve2d,
                                                         ...);

Object Hierarchy

  GObject
   +----GooCanvasItemSimple
         +----GooCanvasGroup
               +----GooCurve2d

Implemented Interfaces

GooCurve2d implements GooCanvasItem.

Properties

  "area-direction"           gchar                 : Read / Write
  "area-linetype"            gchar                 : Read / Write
  "channels"                 gchar                 : Read / Write
  "errors"                   gchar                 : Read / Write
  "line-type"                gchar                 : Read / Write
  "markers"                  gchar                 : Read / Write
  "perpendiculars"           gchar                 : Read / Write
  "vectors"                  gchar                 : Read / Write

Description

GooCurve2d is a subclass of GooCanvasGroup and so inherits all of the style properties such as "stroke-color", "fill-color" and "line-width". It also inherits the GooCanvasItem interface, so you can use the GooCanvasItem functions such as goo_canvas_item_raise() and goo_canvas_item_rotate().

To create a GooCurve2d use goo_curve2d_new().

Setting a style property on a GooCurve2d will affect all children in the GooCurve2d group (unless the children override the property setting).

The GooCurve2d group contains these childs:

  • a GooCanvasPath for an area,

  • a GooCanvasPath for perpendicular lines,

  • a GooCanvasPath for the curve line

  • a GooCanvasPath for markers,

  • a GooCanvasPath for error lines,

  • a GooCanvasPath for vectors,

The childrens are drawn in the given order, so the vectors will be on top and the area is in the background. It's unlikely to use all childs at once. By default just the curve line gets drawn.

To set or get individual properties for the childs use the functions goo_curve2d_[get|set]_XYZ_properties with XYZ for area, perpens, markers, errors and vectors. The remaining item (curve line) is contolled directly by the GooCurve2d properties.

The position and the scale of the curve are connected to the GooAxis for X- and Y direction. Also the transformation matrix of the GooAxis is applied to the GooCurve2d. Note: it's not supported to move the GooAxis after creating the GooCurve2d. Instead put the background box, the GooAxis and the GooCurve2d in to a GooCanvasGroup and move the entire group.

Details

struct GooCurve2d

struct GooCurve2d;

The GooCurve2d struct contains private data only.


struct GooCurve2dClass

struct GooCurve2dClass;

The GooCurve2dClass struct contains private data only.


goo_curve2d_new ()

GooCurve2d *        goo_curve2d_new                     (GooCanvasItem *Parent,
                                                         GooAxis *AxisX,
                                                         GooAxis *AxisY,
                                                         GooDataPoints *Dat,
                                                         ...);

Creates a new curve item.

Parent :

the parent item, or NULL. If a parent is specified, it will assume ownership of the item, and the item will automatically be freed when it is removed from the parent. Otherwise call g_object_unref() to free it.

AxisX :

the X axis to scale the data

AxisY :

the Y axis to scale the data

Dat :

the data values to draw with

... :

optional pairs of property names and values, and a terminating NULL.

Returns :

a new curve2d item. [transfer full]

Since 0.0


goo_curve2d_get_area_properties ()

void                goo_curve2d_get_area_properties     (GooCurve2d *Curve2d,
                                                         ...);

Get one or more properties of the areas GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_get_errors_properties ()

void                goo_curve2d_get_errors_properties   (GooCurve2d *Curve2d,
                                                         ...);

Get one or more properties of the errors GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_get_markers_properties ()

void                goo_curve2d_get_markers_properties  (GooCurve2d *Curve2d,
                                                         ...);

Get one or more properties of the markers GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_get_perpens_properties ()

void                goo_curve2d_get_perpens_properties  (GooCurve2d *Curve2d,
                                                         ...);

Get one or more properties of the perpendiculars GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_get_vectors_properties ()

void                goo_curve2d_get_vectors_properties  (GooCurve2d *Curve2d,
                                                         ...);

Get one or more properties of the vectors GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_set_area_properties ()

void                goo_curve2d_set_area_properties     (GooCurve2d *Curve2d,
                                                         ...);

Set one or more properties for the areas GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_set_errors_properties ()

void                goo_curve2d_set_errors_properties   (GooCurve2d *Curve2d,
                                                         ...);

Set one or more properties for the errors GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_set_markers_properties ()

void                goo_curve2d_set_markers_properties  (GooCurve2d *Curve2d,
                                                         ...);

Set one or more properties for the markers GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_set_perpens_properties ()

void                goo_curve2d_set_perpens_properties  (GooCurve2d *Curve2d,
                                                         ...);

Set one or more properties for the perpendiculars GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0


goo_curve2d_set_vectors_properties ()

void                goo_curve2d_set_vectors_properties  (GooCurve2d *Curve2d,
                                                         ...);

Set one or more properties for the vectors GooCanvasPath.

Curve2d :

a GooCurve2d

... :

optional pairs of property names and values, and a terminating NULL.

Since 0.0

Property Details

The "area-direction" property

  "area-direction"           gchar                 : Read / Write

Draw a colored area from the curve to a given line. This may contain

  • no value to draw no area (= default). Example "" or NULL

  • one of the start letters 'n', 'w', 's', 'e' (for north, west, ...) to draw the area to the given border of the background box. Example: "e" or "east".

  • the start letter 'x' and a value to draw the area to the given value at the X-axis. Example: "x 1.5".

  • the start letter 'y' and a value to draw the area to the given value at the Y-axis. Example: "y 1.5".

  • the start letter 'h' and a value to draw the area to the X-value of the given channel in Dat (the area is between both curves in horizontal direction). Example: "h 3"

  • the start letter 'v' and a value to draw the area to the Y-value of the given channel in Dat (the area is between both curves in vertical direction). Example: "v 3"

Default value: NULL

Since 0.0


The "area-linetype" property

  "area-linetype"            gchar                 : Read / Write

The type of the areas curve line (ignored if "area-direction" is unset). This may contain:

  • no value to draw the area curve by straight lines between the points in Dat. Example "" or NULL.

  • the start letter "h" to draw a stepped curve (histrogram style), starting with a horizontal line. Example: "h" or "Horizontal".

  • the start letter "v" to draw a stepped curve (histrogram style), starting with a vertical line. Example: "v" or "Vertical".

  • the start letter "b" to draw a smooth curve (smoothing by a quadratic bezier curve). Example: "b" or "bezier".

  • the start letter "b" and a value in the range [0,1] to draw a smooth curve (smoothing by cubic bezier curve). The value specifies a smoothing factor. The bigger the value the smoother the line at the points. If the value is outside the range it will be set to the nearest border. For details see "line-type". Example: "b 0.6" or "bezier 0.6".

Default value: NULL

Since 0.0


The "channels" property

  "channels"                 gchar                 : Read / Write

The channels (columns) in the Dat array for the values of the curve. The first value is for X channel, the second is Y. In case of an nagative value the position isn't red from the Dat array. Instead all values are placed equidistantly on the axis in the given order. This may contain

  • no value to use default channels (X = 0, Y = 1). Example "" or NULL.

  • one value to set the Y-channel, X is set to -1. Example: "3" (is equal to "-1 3").

  • two values to set both, the X and the Y channel. Example: "7 9" for X-channel = 7 and Y-channel = 9.

When a channel number is greater than the number of columns in Dat no curve will be drawn.

Default value: NULL

Since 0.0


The "errors" property

  "errors"                   gchar                 : Read / Write

The size and the channels for error markers. An error marker is a T-shaped line drawn in positive or negative X- or Y-direction to show the possible error at a point. Each direction may have its own channel in Dat. But the same channel also can be used to draw error markers equidistantly in more than one direction. This may contain:

  • no value to draw no error lines (= default). Example "" or NULL

  • one value for the line size and one channel to drawn error lines equidistantly above and below the point.

  • one value for the line size and two channels to drawn error lines above and below the point. The first channel sets the distance for the upper line and the second channel sets the lower error line.

  • one value for the line size and three channels to drawn error lines above and below the point and equidistantly to the left and right. The first two channels set the vertical distances and the third channel sets the equidistant right and left error line.

  • one value for the line size and four channels to drawn individual error lines above, below, left and right the point. The first pair of channels set the vertical distances and the second pair set the horizontal distances of the error lines.

The size value has to be set for each direction. It specifies the width of the T-shaped line in global scale. If the size is smaller or equal to 0.0 the default value of 8.0 is set.

The distances of the error lines are scalled by the corresponding GooAxis, so Dat should contain the error values in the same scale as the points. Note: you can use variable sized markers (property "marker-size" with start letter 'c') to show an error range in global scale.

To omit the error lines in one direction set the corresponding channel to -1.

Negative values in the Dat error channels will be scaled by -1 before drawing the error markers.

Default value: NULL

Since 0.0


The "line-type" property

  "line-type"                gchar                 : Read / Write

The type of the curve line. This may contain:

  • no value to draw the curve by straight lines between the points in Dat. Example "" or NULL.

  • the start letter "n" to draw no curve. Example: "n" or "none".

  • the start letter "h" to draw a stepped curve (histrogram style), starting with a horizontal line. Example: "h" or "Horizontal".

  • the start letter "v" to draw a stepped curve (histrogram style), starting with a vertical line. Example: "v" or "Vertical".

  • the start letter "b" to draw a smooth curve by a quadratic bezier curve. Example: "b" or "bezier".

  • the start letter "b" and a value in the range [0,1] to draw a smooth curve by a cubic bezier curve with (if the value is outside the range it will be set to the nearest border). Example: "b 0.6" or "bezier 0.6".

In case of a cubic bezier curve the value sets a form factor, used to specify the distance of the computed bezier points from the given curve points. A high form factor makes the line moderately curved at the Dat points. The factor 1.0 sets a distance of 50 % of the line length between the Dat points. The factor 0.0 sets no distance between curve points and bezier points (equals to a straight line).

Default value: NULL

Since 0.0


The "markers" property

  "markers"                  gchar                 : Read / Write

The size and the type of the markers. This may contain

  • no value for no markers: Example: NULL or "".

  • one value for markers in this fixed size, scaled in global scaling. Example: "14"

  • two values for fixed marker size (global scaling) and marker type (GooDataMarkers). Example: "14 " & GOO_MARKER_CROSS

  • the start letter 'c' and a value to set a channel to read the marker size from. The markers will be variable scaled by the values of the given channel in Dat. Global scalling is used as in the GooCanvas (neither the X- nor the Y-axis scaling are used). Example "Channel 3" to read the marker size from channel 3 in Dat.

  • the start letter 'c' and two values to set a channel (marker size) and the marker type. Example "Channel 2 " & GOO_MARKER_FLOWER to generate flower markers for size values red from channel 2 in Dat.

  • the start letter 'c' and three values to set a channel (marker size), the marker type and a scaling factor. Example "Channel 2 " & GOO_MARKER_CIRCLE & " 3.5" to generate circle markers of the size values red from channel 2 in Dat and scaled by 3.5.

  • the start letter 'd' to generate default markers (GOO_MARKER_CIRCLE) in default size (8.0). Example "d" or "Default"

  • the start letter 'd' and a marker type (GooDataMarkers) to generate the specified marker type in default size (8.0). Example "d " & GOO_MARKER_CROSS

If the marker type specification (if any) is outside the range of GooDataMarkers the standard marker type is used (GOO_MARKER_CIRCLE).

Default value: NULL

Since 0.0


The "perpendiculars" property

  "perpendiculars"           gchar                 : Read / Write

Draw perpendiculars from the curve points to a given direction and value. This may contain

  • no value to draw no perpendiculars (= default). Example "" or NULL

  • one of the start letters 'n', 'w', 's', 'e' (for north, west, ...) to draw perpendiculars to the given border of the background box. Example: "e" or "east".

  • the start letter 'x' and a value to draw perpendiculars to the given value at the X-axis. Example: "x -1.5".

  • the start letter 'y' and a value to draw perpendiculars to the given value at the Y-axis. Example: "y -1.5".

  • the start letter 'h' and a value to draw perpendiculars to the X-value of the given channel in Dat (the perpendiculars are between both curves in horizontal direction). Example: "H 3"

  • the start letter 'v' and a value to draw perpendiculars to the Y-value of the given channel in Dat (the perpendiculars are between both curves in vertical direction). Example: "V 3"

Default value: NULL

Since 0.0


The "vectors" property

  "vectors"                  gchar                 : Read / Write

The channels for vectors. A vector is a straight line drawn to either a slope value or a direction specified by the X- and Y-value of two vector channels. This may contain:

  • no value to draw no vector lines (= default). Example "" or NULL

  • two values for the channels in Dat to read the difference vector from.

  • The start letter 'z' and one or two values for the channel in Dat to read slope value and the optional length of the slope line (defaults to 8).

The difference vectors are scalled by the corresponding GooAxis, so Dat should contain the vector values in the same scale as the points.

Default value: NULL

Since 0.0