## GogGraph

GogGraph

## Synopsis

                        GogGraph;
                        GogGraphClass;
    gboolean            gog_graph_validate_chart_layout     (GogGraph *graph);
    unsigned            gog_graph_num_cols                  (GogGraph const *graph);
    unsigned            gog_graph_num_rows                  (GogGraph const *graph);
    GogGraph *          gog_graph_dup                       (GogGraph const *graph);
    GogTheme *          gog_graph_get_theme                 (GogGraph const *graph);
    void                gog_graph_set_theme                 (GogGraph *graph,
                                                             GogTheme *theme);
    GSList *            gog_graph_get_data                  (GogGraph const *graph);
    GOData *            gog_graph_ref_data                  (GogGraph *graph,
                                                             GOData *dat);
    void                gog_graph_unref_data                (GogGraph *graph,
                                                             GOData *dat);
    void                gog_graph_get_size                  (GogGraph *graph,
                                                             double *width,
                                                             double *height);
    void                gog_graph_set_size                  (GogGraph *graph,
                                                             double width,
                                                             double height);
    GSList *            gog_graph_get_supported_image_formats
                                                            (void);
    gboolean            gog_graph_export_image              (GogGraph *graph,
                                                             GOImageFormat format,
                                                             GsfOutput *output,
                                                             double x_dpi,
                                                             double y_dpi);
    void                gog_graph_render_to_cairo           (GogGraph *graph,
                                                             cairo_t *cairo,
                                                             double w,
                                                             double h);

                        GogGraphView;
    void                gog_graph_view_handle_event         (GogGraphView *gview,
                                                             GdkEvent *event,
                                                             double x_offset,
                                                             double y_offset);
    GogView *           gog_graph_view_get_selection        (GogGraphView *gview);
    void                gog_graph_view_set_selection        (GogGraphView *gview,
                                                             GogObject *gobj);

## Object Hierarchy

      GObject
       +----GogObject
             +----GogStyledObject
                   +----GogOutlinedObject
                         +----GogGraph

      GObject
       +----GogView
             +----GogOutlinedView
                   +----GogGraphView

## Implemented Interfaces

GogGraph implements GOStyledObject.

## Properties

      "document"                 GODoc*                : Read / Write
      "height-pts"               gdouble               : Read / Write
      "theme"                    GogTheme*             : Read / Write
      "theme-name"               gchar*                : Read / Write
      "width-pts"                gdouble               : Read / Write
      "renderer"                 GogRenderer*          : Write

## Signals

      "add-data"                                       : Run Last
      "remove-data"                                    : Run Last
      "selection-changed"                              : Run Last

## Description

## Details

### GogGraph

    typedef struct _GogGraph GogGraph;

### GogGraphClass

    typedef struct {
    	GogOutlinedObjectClass base;

    	/* signals */
    	void (*add_data)    (GogGraph *graph, GOData *input);
    	void (*remove_data) (GogGraph *graph, GOData *input);
    } GogGraphClass;

### gog_graph_validate_chart_layout ()

    gboolean            gog_graph_validate_chart_layout     (GogGraph *graph);

Check the layout of the chart grid and ensure that there are no empty cols or rows, and resize as necessary

`graph` : | GogGraph
Returns : | `TRUE` if anything changed.

### gog_graph_num_cols ()

    unsigned            gog_graph_num_cols                  (GogGraph const *graph);

`graph` : |
Returns : |

### gog_graph_num_rows ()

    unsigned            gog_graph_num_rows                  (GogGraph const *graph);

`graph` : |
Returns : |

### gog_graph_dup ()

    GogGraph *          gog_graph_dup                       (GogGraph const *graph);

`graph` : | GogGraph
Returns : | a deep copy of `graph`.

### gog_graph_get_theme ()

    GogTheme *          gog_graph_get_theme                 (GogGraph const *graph);

`graph` : |
Returns : |

### gog_graph_set_theme ()

    void                gog_graph_set_theme                 (GogGraph *graph,
                                                             GogTheme *theme);

`graph` : |
`theme` : |

### gog_graph_get_data ()

    GSList *            gog_graph_get_data                  (GogGraph const *graph);

`graph` : | GogGraph
Returns : | a list of the GOData objects that are data to the graph. The caller should _not_ modify or free the list.

### gog_graph_ref_data ()

    GOData *            gog_graph_ref_data                  (GogGraph *graph,
                                                             GOData *dat);

`graph` : | GogGraph
`dat` : | GOData
Returns : | `dat` or something equivalent to it that already exists in the graph. Otherwise use `dat`. Adds a gobject ref to the target and increments a count of the number of refs made from this GogGraph.

### gog_graph_unref_data ()

    void                gog_graph_unref_data                (GogGraph *graph,
                                                             GOData *dat);

`graph` : | GogGraph
`dat` : | GOData

### gog_graph_get_size ()

    void                gog_graph_get_size                  (GogGraph *graph,
                                                             double *width,
                                                             double *height);

FIXME Returns the logical size of graph, in points.

`graph` : | GogGraph
`width` : | logical width in pts
`height` : | logical height in pts

### gog_graph_set_size ()

    void                gog_graph_set_size                  (GogGraph *graph,
                                                             double width,
                                                             double height);

Sets the logical size of graph, given in points.

`graph` : | GogGraph
`width` : | logical width in pts
`height` : | logical height in pts

### gog_graph_get_supported_image_formats ()

    GSList *            gog_graph_get_supported_image_formats
                                                            (void);

Builds a list of supported formats for image export.

Returns : | a GSList of GOImageFormat.

### gog_graph_export_image ()

    gboolean            gog_graph_export_image              (GogGraph *graph,
                                                             GOImageFormat format,
                                                             GsfOutput *output,
                                                             double x_dpi,
                                                             double y_dpi);

Exports an image of `graph` in given `format`, writing results in a GsfOutput stream. If export format type is a bitmap one, it computes image size with x_dpi, y_dpi and `graph` size (see @`gog_graph_get_size()`).

`graph` : | a GogGraph
`format` : | image format for export
`output` : | a GsfOutput stream
`x_dpi` : | x resolution of exported graph
`y_dpi` : | y resolution of exported graph
Returns : | `TRUE` if export succeed.

### gog_graph_render_to_cairo ()

    void                gog_graph_render_to_cairo           (GogGraph *graph,
                                                             cairo_t *cairo,
                                                             double w,
                                                             double h);

Renders a graph using `cairo`. `w` and `h` are the requested width an height of the rendered graph, in the current `cairo` coordinate space. This function is not suited for multiple rendering of the same graph. gog_renderer_render_to cairo or gog_renderer_update/gog_renderer_get_cairo_surface should be used instead.

`graph` : | a GogGraph
`cairo` : | a cairo context
`w` : | width
`h` : | height

### GogGraphView

    typedef struct _GogGraphView GogGraphView;

### gog_graph_view_handle_event ()

    void                gog_graph_view_handle_event         (GogGraphView *gview,
                                                             GdkEvent *event,
                                                             double x_offset,
                                                             double y_offset);

Handle events.

`gview` : | GogGraphView
`event` : | GdkEvent
`x_offset` : | in pixels
`y_offset` : | in pixels

### gog_graph_view_get_selection ()

    GogView *           gog_graph_view_get_selection        (GogGraphView *gview);

`gview` : | GogGraphView
Returns : | current selected view.

### gog_graph_view_set_selection ()

    void                gog_graph_view_set_selection        (GogGraphView *gview,
                                                             GogObject *gobj);

Sets `gobj` as current selection. If `gobj` is different from previously selected object, a selection-changed signal is emitted.

`gview` : | GogGraphView
`gobj` : | new selected object

## Property Details

### The `"document"` property

      "document"                 GODoc*                : Read / Write

the document for this graph.

### The `"height-pts"` property

      "height-pts"               gdouble               : Read / Write

Logical graph height, in points.

Allowed values: >= 0

Default value: 226.772

### The `"theme"` property

      "theme"                    GogTheme*             : Read / Write

The theme for elements of the graph.

### The `"theme-name"` property

      "theme-name"               gchar*                : Read / Write

The name of the theme for elements of the graph.

Default value: "default"

### The `"width-pts"` property

      "width-pts"                gdouble               : Read / Write

Logical graph width, in points.

Allowed values: >= 0

Default value: 340.157

### The `"renderer"` property

      "renderer"                 GogRenderer*          : Write

the renderer for this view.

## Signal Details

### The `"add-data"` signal

    void                user_function                      (GogGraph *graph,
                                                            GObject  *data,
                                                            gpointer  user_data)      : Run Last

The ::add-data signal is emitted BEFORE `data` has been added.

`graph` : | the object on which the signal is emitted
`data` : | The new GOData being added to `graph`
`user_data` : | user data set when the signal handler was connected.

### The `"remove-data"` signal

    void                user_function                      (GogGraph *graph,
                                                            GObject  *data,
                                                            gpointer  user_data)      : Run Last

The ::remove-data signal is emitted BEFORE `data` has been removed.

`graph` : | the object on which the signal is emitted
`data` : | The new GOData being removed to `graph`
`user_data` : | user data set when the signal handler was connected.

### The `"selection-changed"` signal

    void                user_function                      (GogGraphView *goggraphview,
                                                            GObject      *arg1,
                                                            gpointer      user_data)         : Run Last

`goggraphview` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.