1 /* @include ajgraphstruct *****************************************************
2 **
3 ** General Plot/Printing data structure
4 **
5 ** @version $Revision: 1.10 $
6 ** @modified $Date: 2011/10/18 14:23:41 $ by $Author: rice $
7 ** @@
8 **
9 ** This library is free software; you can redistribute it and/or
10 ** modify it under the terms of the GNU Lesser General Public
11 ** License as published by the Free Software Foundation; either
12 ** version 2.1 of the License, or (at your option) any later version.
13 **
14 ** This library is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 ** Lesser General Public License for more details.
18 **
19 ** You should have received a copy of the GNU Lesser General Public
20 ** License along with this library; if not, write to the Free Software
21 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 ** MA  02110-1301,  USA.
23 **
24 ******************************************************************************/
25 
26 #ifndef AJGRAPHSTRUCT_H
27 #define AJGRAPHSTRUCT_H
28 
29 #define MAX_STRING 180
30 
31 
32 /* ========================================================================= */
33 /* ============================= include files ============================= */
34 /* ========================================================================= */
35 
36 #include "ajdefine.h"
37 #include "ajmess.h"
38 #include "ajstr.h"
39 
40 AJ_BEGIN_DECLS
41 
42 
43 
44 
45 /* ========================================================================= */
46 /* =============================== constants =============================== */
47 /* ========================================================================= */
48 
49 
50 
51 
52 /* ========================================================================= */
53 /* ============================== public data ============================== */
54 /* ========================================================================= */
55 
56 
57 
58 
59 /* @data AjPGraphobj *******************************************************
60 **
61 ** AJAX data structure for graph objects, contained as a substructure
62 ** in AjPGraphdata
63 **
64 ** @attr type [ajuint] Object type in AjEGraphObjectTypes
65 ** @attr colour [ajuint] See AjEGraphColour for plplot colours
66 ** @attr text [AjPStr] Text to plot
67 ** @attr xx1 [float] x start
68 ** @attr xx2 [float] x end
69 ** @attr yy1 [float] y start
70 ** @attr yy2 [float] y end
71 ** @attr next [struct AjSGraphobj*] link to next object in the list
72 ** @attr scale [float] scale for text (0.0 to use the default)
73 ** @attr Padding [char[4]] Padding to alignment boundary
74 ** @@
75 ******************************************************************************/
76 
77 typedef struct AjSGraphobj {
78   ajuint type;
79   ajuint colour;
80   AjPStr text;
81   float xx1;
82   float xx2;
83   float yy1;
84   float yy2;
85   struct AjSGraphobj *next;
86   float scale;
87   char Padding[4];
88 } AjOGraphobj;
89 #define AjPGraphobj AjOGraphobj*
90 
91 
92 
93 
94 /* @data AjPGraphdata ******************************************************
95 **
96 ** Graph data object. Substructure of AjPGraph.
97 **
98 ** @attr x [float*] x coordinates
99 ** @attr y [float*] y coordinates
100 ** @attr Dataobj [AjPGraphobj] First graph object - links to rest
101 ** @attr title [AjPStr] Plot title
102 ** @attr subtitle [AjPStr] Plot subtitle
103 ** @attr xaxis [AjPStr] Plot x axis title
104 ** @attr yaxis [AjPStr] Plot y axis title
105 ** @attr gtype [AjPStr] Graph type: 2D, Tick etc
106 ** @attr dataname [AjPStr] Source data name
107 ** @attr xcalc [AjBool] if x calculated then delete after
108 ** @attr ycalc [AjBool] as with x. So we do not delete data if it was
109 **                      passed as a ptr
110 ** @attr truescale [AjBool] if true xy scale has been set
111 ** @attr numofpoints [ajuint] Number of points in x and y
112 ** @attr numofobjects [ajuint] Number of graph objects starting at Obj
113 ** @attr minX [float] Lowest x value
114 ** @attr maxX [float] Highest x value
115 ** @attr minY [float] Lowest y value
116 ** @attr maxY [float] Highest y value
117 ** @attr tminX [float] First x value to plot
118 ** @attr tmaxX [float] Last x value to plot
119 ** @attr tminY [float] First y value to plot
120 ** @attr tmaxY [float] Last y value to plot
121 ** @attr colour [ajint] See AjEGraphColour for plplot colours
122 ** @attr lineType [ajint] Line type for plplot
123 ** @attr Padding [char[4]] Padding to alignment boundary
124 ** @@
125 ******************************************************************************/
126 
127 typedef struct AjSGraphdata {
128   float *x;
129   float *y;
130   AjPGraphobj Dataobj;
131   AjPStr title;
132   AjPStr subtitle;
133   AjPStr xaxis;
134   AjPStr yaxis;
135   AjPStr gtype;
136   AjPStr dataname;
137   AjBool xcalc;
138   AjBool ycalc;
139   AjBool truescale;
140   ajuint numofpoints;
141   ajuint numofobjects;
142   float minX;
143   float maxX;
144   float minY;
145   float maxY;
146   float tminX;
147   float tmaxX;
148   float tminY;
149   float tmaxY;
150   ajint colour;
151   ajint lineType;
152   char Padding[4];
153 } AjOGraphdata;
154 #define AjPGraphdata AjOGraphdata*
155 
156 
157 
158 
159 /* @data AjPGraph *************************************************************
160 **
161 ** Graph object.
162 **
163 ** @attr displaytype [ajuint] Displaytype index to graphType
164 ** @attr numsets [ajuint] Number of sets in a multiple graph
165 ** @attr numofgraphs [ajuint] Number of graphs in graphs
166 ** @attr numofobjects [ajuint] Number of objects in Mainobj
167 ** @attr numofgraphsmax [ajuint] Maximum number of graphs expected
168 ** @attr flags [ajuint] over rides the EmbGraphData flags
169 ** @attr minX [float] Lowest x value for all graphs
170 ** @attr maxX [float] Highest x value for all graphs
171 ** @attr minY [float] Lowest y value for all graphs
172 ** @attr maxY [float] Highest y value for all graphs
173 ** @attr xstart [float] First x value to plot
174 ** @attr xend [float] Last x value to plot
175 ** @attr ystart [float] First y value to plot
176 ** @attr yend [float] Last y value to plot
177 ** @attr ready [AjBool] Set by plplot device init
178 ** @attr minmaxcalc [AjBool] Set true when (xy)start/end are set
179 ** @attr windowset [AjBool] Set true when (xy) window coordinates are set
180 ** @attr isdata [AjBool] True for a data type graph
181 ** @attr desc [AjPStr] Plot description, used to set default title
182 ** @attr title [AjPStr] Plot title
183 ** @attr subtitle [AjPStr] Plot subtitle
184 ** @attr xaxis [AjPStr] Plot x axis title
185 ** @attr yaxis [AjPStr] Plot y axis title
186 ** @attr outputfile [AjPStr] Output filename
187 ** @attr dataname [AjPStr] Data source name for datafile outputs
188 ** @attr graphs [AjPGraphdata*] XY Data to plot for Graph(s)
189 ** @attr Mainobj [AjPGraphobj] Objects to plot for single graph
190 ** @@
191 ******************************************************************************/
192 
193 typedef struct AjSGraph {
194 
195   ajuint displaytype;
196   ajuint numsets;
197   ajuint numofgraphs;
198   ajuint numofobjects;
199   ajuint numofgraphsmax;
200   ajuint flags;
201   float minX;
202   float maxX;
203   float minY;
204   float maxY;
205   float xstart;
206   float xend;
207   float ystart;
208   float yend;
209   AjBool ready;
210   AjBool minmaxcalc;
211   AjBool windowset;
212   AjBool isdata;
213   AjPStr desc;
214   AjPStr title;
215   AjPStr subtitle;
216   AjPStr xaxis;
217   AjPStr yaxis;
218   AjPStr outputfile;
219   AjPStr dataname;
220   AjPGraphdata *graphs;
221   AjPGraphobj Mainobj;
222 } AjOGraph;
223 #define AjPGraph AjOGraph*
224 
225 enum AjEGraphColours {BLACK, RED, YELLOW, GREEN, AQUAMARINE,
226 		      PINK, WHEAT, GREY, BROWN, BLUE, BLUEVIOLET,
227 		      CYAN, TURQUOISE, MAGENTA, SALMON, WHITE};
228 
229 
230 #define MAXCOL 15
231 
232 /* ========================================================================= */
233 /* =========================== public functions ============================ */
234 /* ========================================================================= */
235 
236 
237 
238 AJ_END_DECLS
239 
240 #endif  /* !AJGRAPHSTRUCT_H */
241