## GwyGraphCurveModel

GwyGraphCurveModel — Representation of one graph curve

## Synopsis

    #include <libgwydgets/gwydgets.h>

                        GwyGraphCurveModel;
                        GwyGraphCurveModelClass;
    #define             gwy_graph_curve_model_duplicate     (gcmodel)
    GwyGraphCurveModel* gwy_graph_curve_model_new           (void);
    GwyGraphCurveModel* gwy_graph_curve_model_new_alike     (GwyGraphCurveModel *gcmodel);
    void                gwy_graph_curve_model_set_data      (GwyGraphCurveModel *gcmodel,
                                                             const gdouble *xdata,
                                                             const gdouble *ydata,
                                                             gint n);
    void                gwy_graph_curve_model_set_data_from_dataline
                                                            (GwyGraphCurveModel *gcmodel,
                                                             GwyDataLine *dline,
                                                             gint from_index,
                                                             gint to_index);
    const gdouble*      gwy_graph_curve_model_get_xdata     (GwyGraphCurveModel *gcmodel);
    const gdouble*      gwy_graph_curve_model_get_ydata     (GwyGraphCurveModel *gcmodel);
    gint                gwy_graph_curve_model_get_ndata     (GwyGraphCurveModel *gcmodel);
    gboolean            gwy_graph_curve_model_get_x_range   (GwyGraphCurveModel *gcmodel,
                                                             gdouble *x_min,
                                                             gdouble *x_max);
    gboolean            gwy_graph_curve_model_get_y_range   (GwyGraphCurveModel *gcmodel,
                                                             gdouble *y_min,
                                                             gdouble *y_max);
    gboolean            gwy_graph_curve_model_get_ranges    (GwyGraphCurveModel *gcmodel,
                                                             gboolean x_logscale,
                                                             gboolean y_logscale,
                                                             gdouble *x_min,
                                                             gdouble *x_max,
                                                             gdouble *y_min,
                                                             gdouble *y_max);

## Object Hierarchy

      GObject
       +----GwyGraphCurveModel

## Implemented Interfaces

GwyGraphCurveModel implements GwySerializable.

## Properties

      "color"                    GwyRGBA*              : Read / Write
      "description"              gchar*                : Read / Write
      "line-style"               GdkLineStyle          : Read / Write
      "line-width"               gint                  : Read / Write
      "mode"                     GwyGraphCurveType     : Read / Write
      "point-size"               gint                  : Read / Write
      "point-type"               GwyGraphPointType     : Read / Write

## Signals

      "data-changed"                                   : Run First

## Description

GwyGraphCurveModel represents information about a graph curve necessary to fully reconstruct it.

## Details

### GwyGraphCurveModel

    typedef struct _GwyGraphCurveModel GwyGraphCurveModel;

### GwyGraphCurveModelClass

    typedef struct {
        GObjectClass parent_class;

        void (*data_changed)(GwyGraphCurveModel *model);

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

### gwy_graph_curve_model_duplicate()

    #define             gwy_graph_curve_model_duplicate(gcmodel)

Convenience macro doing `gwy_serializable_duplicate()` with all the necessary typecasting.

`gcmodel` : | A graph curve model to duplicate.

### gwy_graph_curve_model_new ()

    GwyGraphCurveModel* gwy_graph_curve_model_new           (void);

Creates a new graph curve model.

Returns : | New empty graph curve model as a GObject.

### gwy_graph_curve_model_new_alike ()

    GwyGraphCurveModel* gwy_graph_curve_model_new_alike     (GwyGraphCurveModel *gcmodel);

Creates new graph curve model object that has the same settings as `gcmodel`.

Curve data are not duplicated.

`gcmodel` : | A graph curve model.
Returns : | New graph curve model.

### gwy_graph_curve_model_set_data ()

    void                gwy_graph_curve_model_set_data      (GwyGraphCurveModel *gcmodel,
                                                             const gdouble *xdata,
                                                             const gdouble *ydata,
                                                             gint n);

Sets curve model data.

`gcmodel` : | A graph curve model.
`xdata` : | X data points (array of size `n`).
`ydata` : | Y data points (array of size `n`).
`n` : | Number of points, i.e. items in `xdata` and `ydata`.

### gwy_graph_curve_model_set_data_from_dataline ()

    void                gwy_graph_curve_model_set_data_from_dataline
                                                            (GwyGraphCurveModel *gcmodel,
                                                             GwyDataLine *dline,
                                                             gint from_index,
                                                             gint to_index);

Sets the curve data from GwyDataLine. The range of import can be modified using parameters `from_index` and `to_index` that are interpreted directly as data indices within the GwyDataLine. In the case that `from_index` == `to_index`, the full GwyDataLine is used.

`gcmodel` : | A graph curve model.
`dline` : | A GwyDataLine
`from_index` : | index where to start
`to_index` : | where to stop

### gwy_graph_curve_model_get_xdata ()

    const gdouble*      gwy_graph_curve_model_get_xdata     (GwyGraphCurveModel *gcmodel);

Gets pointer to x data points.

Data are used within the graph and cannot be freed.

`gcmodel` : | A graph curve model.
Returns : | X data points, owned by the curve model.

### gwy_graph_curve_model_get_ydata ()

    const gdouble*      gwy_graph_curve_model_get_ydata     (GwyGraphCurveModel *gcmodel);

Gets pointer to y data points.

Data are used within the graph and cannot be freed.

`gcmodel` : | A graph curve model.
Returns : | Y data points, owned by the curve model.

### gwy_graph_curve_model_get_ndata ()

    gint                gwy_graph_curve_model_get_ndata     (GwyGraphCurveModel *gcmodel);

`gcmodel` : | A graph curve model.
Returns : | number of data points within the curve data

### gwy_graph_curve_model_get_x_range ()

    gboolean            gwy_graph_curve_model_get_x_range   (GwyGraphCurveModel *gcmodel,
                                                             gdouble *x_min,
                                                             gdouble *x_max);

Gets the abscissa range of a graph curve.

The values are cached in the curve model therefore repeated calls to this function (with unchanged data) are cheap.

If there are no data points in the curve, `x_min` and `x_max` are untouched and the function returns `FALSE`.

See also `gwy_graph_curve_model_get_ranges()` for a more high-level function.

`gcmodel` : | A graph curve model.
`x_min` : | Location to store the minimum abscissa value, or `NULL`.
`x_max` : | Location to store the maximum abscissa value, or `NULL`.
Returns : | `TRUE` if there are any data points in the curve and `x_min`, `x_max` were set.

### gwy_graph_curve_model_get_y_range ()

    gboolean            gwy_graph_curve_model_get_y_range   (GwyGraphCurveModel *gcmodel,
                                                             gdouble *y_min,
                                                             gdouble *y_max);

Gets the ordinate range of a graph curve.

The values are cached in the curve model therefore repeated calls to this function (with unchanged data) are cheap.

If there are no data points in the curve, `x_min` and `x_max` are untouched and the function returns `FALSE`.

See also `gwy_graph_curve_model_get_ranges()` for a more high-level function.

`gcmodel` : | A graph curve model.
`y_min` : | Location to store the minimum ordinate value, or `NULL`.
`y_max` : | Location to store the maximum ordinate value, or `NULL`.
Returns : | `TRUE` if there are any data points in the curve and `x_min`, `x_max` were set.

### gwy_graph_curve_model_get_ranges ()

    gboolean            gwy_graph_curve_model_get_ranges    (GwyGraphCurveModel *gcmodel,
                                                             gboolean x_logscale,
                                                             gboolean y_logscale,
                                                             gdouble *x_min,
                                                             gdouble *x_max,
                                                             gdouble *y_min,
                                                             gdouble *y_max);

`gcmodel` : |
`x_logscale` : |
`y_logscale` : |
`x_min` : |
`x_max` : |
`y_min` : |
`y_max` : |
Returns : |

## Property Details

### The `"color"` property

      "color"                    GwyRGBA*              : Read / Write

Curve color.

### The `"description"` property

      "description"              gchar*                : Read / Write

Curve description. It appears on graph key.

Default value: "curve"

### The `"line-style"` property

      "line-style"               GdkLineStyle          : Read / Write

Curve line style. Curve mode has to include lines for the line to be visible.

Default value: GDK_LINE_SOLID

### The `"line-width"` property

      "line-width"               gint                  : Read / Write

Curve line width.

Allowed values: [0,100]

Default value: 1

### The `"mode"` property

      "mode"                     GwyGraphCurveType     : Read / Write

Curve plotting mode (line, points, ...).

Default value: GWY_GRAPH_CURVE_LINE

### The `"point-size"` property

      "point-size"               gint                  : Read / Write

Curve point symbol size.

Allowed values: [0,100]

Default value: 5

### The `"point-type"` property

      "point-type"               GwyGraphPointType     : Read / Write

Curve point symbol type. Curve mode has toinclude points for the symbols to be visible.

Default value: GWY_GRAPH_POINT_SQUARE

## Signal Details

### The `"data-changed"` signal

    void                user_function                      (GwyGraphCurveModel *gwygraphcurvemodel,
                                                            gpointer            user_data)               : Run First

The ::data-changed signal is emitted whenever curve data is set with a function like `gwy_graph_curve_model_set_data()`.

`gwygraphcurvemodel` : | The GwyGraphCurveModel which received the signal.
`user_data` : | user data set when the signal handler was connected.