## GogPlot

GogPlot — A plot.

## Synopsis

                        GogPlot;
                        GogPlotClass;
                        GogPlotBoundInfo;
    GogPlot *           gog_plot_new_by_type                (GogPlotType const *type);
    GogPlot *           gog_plot_new_by_name                (char const *id);
    void                gog_plot_request_cardinality_update (GogPlot *plot);
    void                gog_plot_get_cardinality            (GogPlot *plot,
                                                             unsigned *full,
                                                             unsigned *visible);
    void                gog_plot_update_cardinality         (GogPlot *plot,
                                                             int index_num);
    void                gog_plot_foreach_elem               (GogPlot *plot,
                                                             gboolean only_visible,
                                                             GogEnumFunc handler,
                                                             gpointer data);
    GSList const *      gog_plot_get_series                 (GogPlot const *plot);
    GOData *            gog_plot_get_axis_bounds            (GogPlot *plot,
                                                             GogAxisType axis,
                                                             GogPlotBoundInfo *bounds);
    gboolean            gog_plot_supports_vary_style_by_element
                                                            (GogPlot const *plot);
    GogSeries *         gog_plot_new_series                 (GogPlot *plot);
    GogPlotDesc const * gog_plot_description                (GogPlot const *plot);
    GogAxisSet          gog_plot_axis_set_pref              (GogPlot const *plot);
    gboolean            gog_plot_axis_set_is_valid          (GogPlot const *plot,
                                                             GogAxisSet type);
    gboolean            gog_plot_axis_set_assign            (GogPlot *plot,
                                                             GogAxisSet type);
    void                gog_plot_axis_clear                 (GogPlot *plot,
                                                             GogAxisSet filter);
    void                gog_plot_set_axis                   (GogPlot *plot,
                                                             GogAxis *axis);
    GogAxis *           gog_plot_get_axis                   (GogPlot const *plot,
                                                             GogAxisType type);
    void                gog_plot_update_3d                  (GogPlot *plot);
    void                gog_plot_guru_helper                (GogPlot *plot);
    void                gog_plot_clear_series               (GogPlot *plot);

                        GogPlotView;
    int                 gog_plot_view_get_data_at_point     (GogPlotView *view,
                                                             double x,
                                                             double y,
                                                             GogSeries **series);

## Object Hierarchy

      GObject
       +----GogObject
             +----GogPlot

      GObject
       +----GogView
             +----GogPlotView

## Properties

      "guru-hints"               gchar*                : Read / Write
      "interpolation"            gchar*                : Read / Write
      "plot-group"               gchar*                : Read / Write
      "vary-style-by-element"    gboolean              : Read / Write
      "x-axis"                   guint                 : Read / Write
      "y-axis"                   guint                 : Read / Write

## Description

This is the object that visualizes data. To manipulate the data shown in the plot, use `gog_plot_new_series()` and `gog_plot_clear_series()`

Plots are implemented as plug-ins, so make sure the plug-in system is initialized before trying to create one. See `go_plugins_init()`

GOffice ships a number of common plot implementations by default.

## Details

### GogPlot

    typedef struct _GogPlot GogPlot;

### GogPlotClass

    typedef struct {
    	GogObjectClass base;

    	GogPlotDesc desc;
    	GType		series_type;

    	GogAxisSet axis_set;

    	/* Virtuals */

    	GOData	  *(*axis_get_bounds) 	(GogPlot *plot, GogAxisType axis,
    					 GogPlotBoundInfo *bounds);

    	gboolean   (*supports_vary_style_by_element) (GogPlot const *plot);

    	/* %TRUE if the plot prefers to display series in reverse order for
    	 * legends (e.g. stacked plots want top element to be the last series) */
    	gboolean   (*enum_in_reverse) (GogPlot const *plot);

    	void       (*foreach_elem)    	(GogPlot *plot, gboolean only_visible,
    					 GogEnumFunc handler, gpointer data);

    	void       (*update_3d)		(GogPlot *plot);
    	void	   (*guru_helper) (GogPlot *plot, char const *hint);
    } GogPlotClass;

### GogPlotBoundInfo

    typedef struct {
    	struct {
    		double minima, maxima;
    	} val, logical;
    	gboolean is_discrete;
    	gboolean center_on_ticks;
    	GOFormat *fmt;

    	const GODateConventions *date_conv;
    } GogPlotBoundInfo;

### gog_plot_new_by_type ()

    GogPlot *           gog_plot_new_by_type                (GogPlotType const *type);

`type` : |
Returns : |

### gog_plot_new_by_name ()

    GogPlot *           gog_plot_new_by_name                (char const *id);

`id` : |
Returns : |

### gog_plot_request_cardinality_update ()

    void                gog_plot_request_cardinality_update (GogPlot *plot);

`plot` : |

### gog_plot_get_cardinality ()

    void                gog_plot_get_cardinality            (GogPlot *plot,
                                                             unsigned *full,
                                                             unsigned *visible);

Return the number of logical elements in the plot. See `gog_chart_get_cardinality`.

`full` and `visible` may be NULL.

`plot` : | GogPlot
`full` : | placeholder for full cardinality
`visible` : | placeholder for visible cardinality

### gog_plot_update_cardinality ()

    void                gog_plot_update_cardinality         (GogPlot *plot,
                                                             int index_num);

Update cardinality and cache result. See `gog_chart_get_cardinality`.

`plot` : | GogPlot
`index_num` : | index offset for this plot

### gog_plot_foreach_elem ()

    void                gog_plot_foreach_elem               (GogPlot *plot,
                                                             gboolean only_visible,
                                                             GogEnumFunc handler,
                                                             gpointer data);

`plot` : |
`only_visible` : |
`handler` : |
`data` : |

### gog_plot_get_series ()

    GSList const *      gog_plot_get_series                 (GogPlot const *plot);

`plot` : | GogPlot
Returns : | A list of the series in `plot`. Do not modify or free the list.

### gog_plot_get_axis_bounds ()

    GOData *            gog_plot_get_axis_bounds            (GogPlot *plot,
                                                             GogAxisType axis,
                                                             GogPlotBoundInfo *bounds);

Queries `plot` for its axis preferences for `axis` and stores the results in `bounds`. All elements of `bounds` are initialized to sane values before the query _EXCEPT_ ::fmt. The caller is responsible for initializing it. This is done so that once on plot has selected a format the others need not do the lookup too if so desired.

Caller is responsible for unrefing ::fmt.

`plot` : | GogPlot
`axis` : | GogAxisType
`bounds` : | GogPlotBoundInfo
Returns : | The data providing the bound (does not add a ref)

### gog_plot_supports_vary_style_by_element ()

    gboolean            gog_plot_supports_vary_style_by_element
                                                            (GogPlot const *plot);

`plot` : |
Returns : |

### gog_plot_new_series ()

    GogSeries *         gog_plot_new_series                 (GogPlot *plot);

`plot` : | GogPlot
Returns : | a new GogSeries of a type consistent with `plot`.

### gog_plot_description ()

    GogPlotDesc const * gog_plot_description                (GogPlot const *plot);

`plot` : |
Returns : |

### gog_plot_axis_set_pref ()

    GogAxisSet          gog_plot_axis_set_pref              (GogPlot const *plot);

`plot` : |
Returns : |

### gog_plot_axis_set_is_valid ()

    gboolean            gog_plot_axis_set_is_valid          (GogPlot const *plot,
                                                             GogAxisSet type);

`plot` : |
`type` : |
Returns : |

### gog_plot_axis_set_assign ()

    gboolean            gog_plot_axis_set_assign            (GogPlot *plot,
                                                             GogAxisSet type);

`plot` : |
`type` : |
Returns : |

### gog_plot_axis_clear ()

    void                gog_plot_axis_clear                 (GogPlot *plot,
                                                             GogAxisSet filter);

A utility method to clear all existing axis associations flagged by `filter`

`plot` : | GogPlot
`filter` : | GogAxisSet

### gog_plot_set_axis ()

    void                gog_plot_set_axis                   (GogPlot *plot,
                                                             GogAxis *axis);

Connect `axis` and `plot`.

`plot` : | GogPlot
`axis` : | GogAxis

### gog_plot_get_axis ()

    GogAxis *           gog_plot_get_axis                   (GogPlot const *plot,
                                                             GogAxisType type);

`plot` : |
`type` : |
Returns : |

### gog_plot_update_3d ()

    void                gog_plot_update_3d                  (GogPlot *plot);

`plot` : |

### gog_plot_guru_helper ()

    void                gog_plot_guru_helper                (GogPlot *plot);

`plot` : |

### gog_plot_clear_series ()

    void                gog_plot_clear_series               (GogPlot *plot);

`plot` : |

### GogPlotView

    typedef struct _GogPlotView GogPlotView;

### gog_plot_view_get_data_at_point ()

    int                 gog_plot_view_get_data_at_point     (GogPlotView *view,
                                                             double x,
                                                             double y,
                                                             GogSeries **series);

Search a data represented at (`x`,`y`) in `view` and set `series` on success.

`view` : | GogPlotView
`x` : | x position
`y` : | y position
`series` : | where to store the series
Returns : | index of the found data in `series` or -1.

## Property Details

### The `"guru-hints"` property

      "guru-hints"               gchar*                : Read / Write

Semicolon separated list of hints for automatic addition of objects in guru dialog.

Default value: NULL

### The `"interpolation"` property

      "interpolation"            gchar*                : Read / Write

Default type of series line interpolation.

Default value: "linear"

### The `"plot-group"` property

      "plot-group"               gchar*                : Read / Write

Name of plot group if any.

Default value: NULL

### The `"vary-style-by-element"` property

      "vary-style-by-element"    gboolean              : Read / Write

Use a different style for each segments.

Default value: FALSE

### The `"x-axis"` property

      "x-axis"                   guint                 : Read / Write

Reference to X axis.

Allowed values: <= G_MAXLONG

Default value: 0

### The `"y-axis"` property

      "y-axis"                   guint                 : Read / Write

Reference to Y axis.

Allowed values: <= G_MAXLONG

Default value: 0

## See Also

GogChart, GogSeries