1 /*
2  * goffice-graph.h:
3  *
4  * Copyright (C) 2003-2004 Jody Goldberg (jody@gnome.org)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) version 3.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
19  * USA
20  */
21 
22 #ifndef GOFFICE_GRAPH_H
23 #define GOFFICE_GRAPH_H
24 
25 #include <glib.h>
26 
27 G_BEGIN_DECLS
28 
29 typedef struct _GogObject	 GogObject;
30 typedef struct _GogObjectRole	 GogObjectRole;
31 typedef struct _GogView		 GogView;	 /* view of an Object */
32 typedef struct _GogGraphView	 GogGraphView;	 /* view of chart */
33 
34 typedef struct _GogGraph	 GogGraph;	/* collection of charts */
35 typedef struct _GogChart	 GogChart;	/* collection of plots */
36 typedef struct _GogPlot		 GogPlot;	/* abstract base for plots */
37 typedef struct _GogPlotType	 GogPlotType;	/* visible characterization */
38 typedef struct _GogPlotFamily	 GogPlotFamily; /* a group of plot types */
39 typedef struct _GogPlotDesc	 GogPlotDesc;	/* data/axis requirements */
40 typedef struct _GogPlotView      GogPlotView;
41 typedef struct _GogSeries	 GogSeries;	/* single plotable entity */
42 typedef struct _GogSeriesDesc	 GogSeriesDesc; /* data requirements */
43 typedef struct _GogSeriesDimDesc GogSeriesDimDesc; /* dimension of a series */
44 
45 /* Useful objects */
46 typedef struct _GogLegend	GogLegend;
47 typedef struct _GogLabel	GogLabel;
48 typedef struct _GogStyledObject	GogStyledObject;
49 typedef struct _GogAxisBase GogAxisBase;
50 typedef struct _GogAxis		GogAxis;
51 typedef struct _GogAxisLine	GogAxisLine;
52 typedef struct _GogAxisColorMap GogAxisColorMap;
53 typedef struct _GogColorScale GogColorScale;
54 typedef struct _GogGrid		GogGrid;
55 typedef struct _GogGridLine	GogGridLine;
56 typedef struct _GogErrorBar	GogErrorBar;
57 typedef struct _GogEquation	GogEquation;
58 typedef struct _GogRegCurve	GogRegCurve;
59 typedef struct _GogRegEqn	GogRegEqn;
60 typedef struct _GogTrendLineType	GogTrendLineType;
61 typedef struct _GogSeriesLines  GogSeriesLines;
62 typedef struct _GogSeriesLabels GogSeriesLabels;
63 typedef struct _GogDataLabel    GogDataLabel;
64 typedef struct _GogSmoothedCurve	GogSmoothedCurve;
65 typedef struct _Gog3DBox	Gog3DBox;
66 
67 /* formating */
68 typedef struct _GogTheme	GogTheme;
69 typedef GSList 			GogSeriesElementStyleList;
70 
71 /* Data */
72 typedef struct _GogDataEditor    GogDataEditor;
73 typedef struct _GogDataAllocator GogDataAllocator;
74 typedef struct _GogDataset	 GogDataset;
75 
76 /* Rendering */
77 typedef struct _GogRenderer	 GogRenderer;
78 
79 typedef struct {
80 	double w, h;
81 } GogViewRequisition;
82 
83 typedef struct _GogViewAllocation {
84 	double w, h;
85 	double x, y;
86 } GogViewAllocation;
87 GType gog_view_allocation_get_type (void);
88 
89 typedef struct {
90 	double wr, hb;
91 	double wl, ht;
92 } GogViewPadding;
93 
94 typedef void (*GogEnumFunc) (unsigned i, gpointer style,
95 			     char const *name, PangoAttrList *l, gpointer data);
96 
97 typedef enum {
98 	GOG_AXIS_UNKNOWN = -1,
99 	GOG_AXIS_X	 = 0,
100 	GOG_AXIS_Y,
101 	GOG_AXIS_Z,
102 	GOG_AXIS_CIRCULAR,
103 	GOG_AXIS_RADIAL,
104 	GOG_AXIS_VIRTUAL,
105 	GOG_AXIS_PSEUDO_3D = GOG_AXIS_VIRTUAL,
106 	GOG_AXIS_COLOR,
107 	GOG_AXIS_BUBBLE,
108 	GOG_AXIS_TYPES
109 } GogAxisType;
110 
111 typedef enum {
112 	GOG_AXIS_SET_UNKNOWN 	  = -1,
113 	GOG_AXIS_SET_NONE   	  = 0,
114 	GOG_AXIS_SET_X		  = (1 << GOG_AXIS_X),
115 	GOG_AXIS_SET_XY		  = (1 << GOG_AXIS_X) | (1 << GOG_AXIS_Y),
116 	GOG_AXIS_SET_XY_pseudo_3d = (1 << GOG_AXIS_X) | (1 << GOG_AXIS_Y) | (1 << GOG_AXIS_PSEUDO_3D),
117 	GOG_AXIS_SET_XY_COLOR 	  = (1 << GOG_AXIS_X) | (1 << GOG_AXIS_Y) | (1 << GOG_AXIS_COLOR),
118 	GOG_AXIS_SET_XY_BUBBLE 	  = (1 << GOG_AXIS_X) | (1 << GOG_AXIS_Y) | (1 << GOG_AXIS_BUBBLE),
119 	GOG_AXIS_SET_XYZ	  = (1 << GOG_AXIS_X) | (1 << GOG_AXIS_Y) | (1 << GOG_AXIS_Z),
120 	GOG_AXIS_SET_RADAR        = (1 << GOG_AXIS_CIRCULAR) | (1 << GOG_AXIS_RADIAL),
121 	GOG_AXIS_SET_FUNDAMENTAL  = ((1 << GOG_AXIS_VIRTUAL) - 1),
122 	GOG_AXIS_SET_ALL	  = ((1 << GOG_AXIS_TYPES) -1)
123 } GogAxisSet;
124 
125 typedef enum {
126 	GOG_DIM_INVALID = -1,
127 	GOG_DIM_LABEL = 0,
128 	GOG_DIM_INDEX,
129 	GOG_DIM_VALUE,
130 	GOG_DIM_MATRIX,
131 	GOG_DIM_TYPES
132 } GogDimType;
133 
134 typedef enum {
135 	GOG_DATA_SCALAR,
136 	GOG_DATA_VECTOR,
137 	GOG_DATA_MATRIX
138 }	GogDataType;
139 
140 /* A helper enum to simplify import/export from MS Excel (tm) which uses the
141  * same logical dim names for all plot types.  Do _NOT_ reorder, or change the
142  * enumeration without checking the xls code */
143 typedef enum {
144 	GOG_MS_DIM_LABELS	= 0,
145 	GOG_MS_DIM_VALUES	= 1,
146 	GOG_MS_DIM_CATEGORIES	= 2,
147 	GOG_MS_DIM_BUBBLES	= 3, /* undocumented */
148 	GOG_MS_DIM_TYPES,
149 	GOG_MS_DIM_ERR_plus1,	/* we made it up */
150 	GOG_MS_DIM_ERR_minus1,	/* we made it up */
151 	GOG_MS_DIM_ERR_plus2,	/* we made it up */
152 	GOG_MS_DIM_ERR_minus2,	/* we made it up */
153 	GOG_MS_DIM_START,	/* we made it up for dropbars*/
154 	GOG_MS_DIM_END,	/* we made it up for dropbars */
155 	GOG_MS_DIM_LOW,	/* we made it up for hi-lo*/
156 	GOG_MS_DIM_HIGH,	/* we made it up for hi-lo */
157 	GOG_MS_DIM_EXTRA1,	/* we made it up for other uses */
158 	GOG_MS_DIM_EXTRA2	/* we made it up for other uses */
159 } GogMSDimType;
160 
161 typedef enum {
162 	GOG_POSITION_AUTO	= 0,
163 	GOG_POSITION_N		= 1 << 0,	/* can be used with E or W */
164 	GOG_POSITION_S		= 1 << 1,	/* can be used with E or W */
165 	GOG_POSITION_E		= 1 << 2,
166 	GOG_POSITION_W		= 1 << 3,
167 	GOG_POSITION_COMPASS	= 0x0f,
168 
169 	/* modifiers for compass */
170 	GOG_POSITION_ALIGN_FILL	  = 0 << 4,
171 	GOG_POSITION_ALIGN_START  = 1 << 4,
172 	GOG_POSITION_ALIGN_END	  = 2 << 4,
173 	GOG_POSITION_ALIGN_CENTER = 3 << 4,
174 	GOG_POSITION_ALIGNMENT	  = 0x30,
175 
176 	GOG_POSITION_SPECIAL	= 1 << 6,
177 
178 	GOG_POSITION_MANUAL	  = 1 << 7,
179 	GOG_POSITION_MANUAL_X_ABS = 1 << 8, /* abs vs relative pos */
180 	GOG_POSITION_MANUAL_Y_ABS = 1 << 9,
181 	GOG_POSITION_MANUAL_X_END = 1 << 10, /* pos relative to start or end */
182 	GOG_POSITION_MANUAL_Y_END = 1 << 11,
183 
184 	/* modifiers for manual */
185 	GOG_POSITION_ANCHOR_NW       = 0 << 12,
186 	GOG_POSITION_ANCHOR_N	     = 1 << 12,
187 	GOG_POSITION_ANCHOR_NE	     = 2 << 12,
188 	GOG_POSITION_ANCHOR_E        = 3 << 12,
189 	GOG_POSITION_ANCHOR_SE       = 4 << 12,
190 	GOG_POSITION_ANCHOR_S        = 5 << 12,
191 	GOG_POSITION_ANCHOR_SW       = 6 << 12,
192 	GOG_POSITION_ANCHOR_W        = 7 << 12,
193 	GOG_POSITION_ANCHOR_CENTER   = 8 << 12,
194 	GOG_POSITION_ANCHOR          = 0x1f000,
195 
196 	GOG_POSITION_ANY_MANUAL      = 0x1ff80,
197 
198 	GOG_POSITION_PADDING	     = 1 << 16,
199 
200 	GOG_POSITION_MANUAL_W        = 1 << 21, /* relative width */
201 	GOG_POSITION_MANUAL_W_ABS    = 1 << 22, /* absolute width */
202 	GOG_POSITION_MANUAL_H        = 1 << 23, /* relative height */
203 	GOG_POSITION_MANUAL_H_ABS    = 1 << 24, /* absolute height */
204 	GOG_POSITION_ANY_MANUAL_SIZE = 0x1e00000,
205 	GOG_POSITION_HEXPAND		 = 1 << 25,
206 	GOG_POSITION_VEXPAND		 = 1 << 26,
207 	GOG_POSITION_EXPAND			 = GOG_POSITION_HEXPAND | GOG_POSITION_VEXPAND
208 } GogObjectPosition;
209 
210 typedef enum {
211 	GOG_PLOT_RENDERING_LAST,
212 	GOG_PLOT_RENDERING_BEFORE_AXIS,
213 	GOG_PLOT_RENDERING_BEFORE_GRID
214 } GogPlotRenderingOrder;
215 
216 typedef enum {
217 	GOG_SERIES_LABELS_DEFAULT_POS = 0,
218 	GOG_SERIES_LABELS_CENTERED = 1,
219 	GOG_SERIES_LABELS_TOP = 1 << 1,
220 	GOG_SERIES_LABELS_BOTTOM = 1 << 2,
221 	GOG_SERIES_LABELS_LEFT = 1 << 3,
222 	GOG_SERIES_LABELS_RIGHT = 1 << 4,
223 	GOG_SERIES_LABELS_OUTSIDE = 1 << 5,
224 	GOG_SERIES_LABELS_INSIDE = 1 << 6,
225 	GOG_SERIES_LABELS_NEAR_ORIGIN = 1 << 7,
226 } GogSeriesLabelsPos;
227 
228 #define GOG_POSITION_IS_SPECIAL(pos) (((pos) & GOG_POSITION_SPECIAL)&&(!((pos) & GOG_POSITION_MANUAL)))
229 #define GOG_POSITION_IS_PADDING(pos) (((pos) & GOG_POSITION_PADDING)&&(!((pos) & GOG_POSITION_MANUAL)))
230 
231 G_END_DECLS
232 
233 #include <goffice/goffice.h>
234 #include <goffice/data/goffice-data.h>
235 #include <goffice/math/goffice-math.h>
236 
237 #include <goffice/graph/gog-object.h>
238 #include <goffice/graph/gog-styled-object.h>
239 #include <goffice/graph/gog-trend-line.h>
240 #include <goffice/graph/gog-view.h>
241 #include <goffice/graph/gog-outlined-object.h>
242 #include <goffice/graph/gog-data-set.h>
243 #include <goffice/graph/gog-series.h>
244 #include <goffice/graph/gog-series-impl.h>
245 
246 #include <goffice/graph/gog-3d-box.h>
247 #include <goffice/graph/gog-axis-line.h>
248 #include <goffice/graph/gog-axis.h>
249 #include <goffice/graph/gog-chart.h>
250 #include <goffice/graph/gog-chart-impl.h>
251 #include <goffice/graph/gog-chart-map.h>
252 #include <goffice/graph/gog-chart-map-3d.h>
253 #include <goffice/graph/gog-axis-color-map.h>
254 #include <goffice/graph/gog-color-scale.h>
255 #ifdef GOFFICE_WITH_GTK
256 #include <goffice/graph/gog-child-button.h>
257 #include <goffice/graph/gog-color-scale.h>
258 #include <goffice/graph/gog-data-allocator.h>
259 #endif
260 #ifdef GOFFICE_WITH_LASEM
261 #include <goffice/graph/gog-equation.h>
262 #endif
263 #include <goffice/graph/gog-error-bar.h>
264 #include <goffice/graph/gog-graph.h>
265 #include <goffice/graph/gog-graph-impl.h>
266 #include <goffice/graph/gog-grid.h>
267 #include <goffice/graph/gog-grid-line.h>
268 #ifdef GOFFICE_WITH_GTK
269 #include <goffice/graph/gog-guru.h>
270 #endif
271 #include <goffice/graph/gog-label.h>
272 #include <goffice/graph/gog-legend.h>
273 #include <goffice/graph/gog-object-xml.h>
274 #include <goffice/graph/gog-plot-engine.h>
275 #include <goffice/graph/gog-plot.h>
276 #include <goffice/graph/gog-plot-impl.h>
277 #include <goffice/graph/gog-reg-curve.h>
278 #include <goffice/graph/gog-series-labels.h>
279 #include <goffice/graph/gog-renderer.h>
280 #include <goffice/graph/gog-series-lines.h>
281 #include <goffice/graph/gog-smoothed-curve.h>
282 #include <goffice/graph/gog-theme.h>
283 
284 #endif /* GOFFICE_GRAPH_H */
285