1 /* acre - A cairo-based library for creating plots and charts.
3 * Copyright © 2009 Carl Worth <cworth@cworth.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23 #include <pango/pangocairo.h>
25 typedef struct _acre acre_t;
26 typedef struct _acre_data acre_data_t;
28 /* Create a new, empty plot. */
34 acre_destroy (acre_t *acre);
37 acre_set_title (acre_t *acre, const char *title);
40 acre_set_x_axis_label (acre_t *acre, const char *label);
43 acre_set_y_axis_label (acre_t *acre, const char *label);
45 /* Add a dataset to the plot. The plot assumes ownership of the
46 * dataset so it is not necessary to call acre_data_destroy on it. */
48 acre_add_data (acre_t *acre, acre_data_t *data);
50 /* Draw the plot to the given cairo context within a user-space
51 * rectangle from (0, 0) to (width, height). This size includes all
52 * space for extra-plot elements (such as the title, the axis labels,
56 acre_draw (acre_t *acre, cairo_t *cr, int width, int height);
58 /* Create a new dataset---a collection of (x, y) datapoints. A single
59 * plot can contain multiple datasets, (see acre_add_data). */
61 acre_data_create (void);
63 /* Destroy an acre dataset. Do not call this function if the dataset
64 * has been added to an acre_t plot with acre_add_data. */
66 acre_data_destroy (acre_data_t *data);
68 /* Set the label for this dataset (to appear in the plot's key). */
70 acre_data_set_name (acre_data_t *data, const char *name);
72 /* Add a datapoint to the given dataset. */
74 acre_data_add_point_2d (acre_data_t *data, double x, double y);