source: trunk/kitgen/8.x/blt/generic/bltGrAxis.h@ 181

Last change on this file since 181 was 175, checked in by demin, 12 years ago

initial commit

File size: 9.1 KB
Line 
1/*
2 * bltGrAxis.h --
3 *
4 * Copyright 1991-1998 Lucent Technologies, Inc.
5 *
6 * Permission to use, copy, modify, and distribute this software and
7 * its documentation for any purpose and without fee is hereby
8 * granted, provided that the above copyright notice appear in all
9 * copies and that both that the copyright notice and warranty
10 * disclaimer appear in supporting documentation, and that the names
11 * of Lucent Technologies any of their entities not be used in
12 * advertising or publicity pertaining to distribution of the software
13 * without specific, written prior permission.
14 *
15 * Lucent Technologies disclaims all warranties with regard to this
16 * software, including all implied warranties of merchantability and
17 * fitness. In no event shall Lucent Technologies be liable for any
18 * special, indirect or consequential damages or any damages
19 * whatsoever resulting from loss of use, data or profits, whether in
20 * an action of contract, negligence or other tortuous action, arising
21 * out of or in connection with the use or performance of this
22 * software.
23 */
24
25#ifndef _BLT_GR_AXIS_H
26#define _BLT_GR_AXIS_H
27
28#include "bltList.h"
29
30/*
31 * -------------------------------------------------------------------
32 *
33 * AxisRange --
34 *
35 * Designates a range of values by a minimum and maximum limit.
36 *
37 * -------------------------------------------------------------------
38 */
39typedef struct {
40 double min, max, range, scale;
41} AxisRange;
42
43/*
44 * ----------------------------------------------------------------------
45 *
46 * TickLabel --
47 *
48 * Structure containing the X-Y screen coordinates of the tick
49 * label (anchored at its center).
50 *
51 * ----------------------------------------------------------------------
52 */
53typedef struct {
54 Point2D anchorPos;
55 int width, height;
56 char string[1];
57} TickLabel;
58
59/*
60 * ----------------------------------------------------------------------
61 *
62 * Ticks --
63 *
64 * Structure containing information where the ticks (major or
65 * minor) will be displayed on the graph.
66 *
67 * ----------------------------------------------------------------------
68 */
69typedef struct {
70 int nTicks; /* # of ticks on axis */
71 double values[1]; /* Array of tick values (malloc-ed). */
72} Ticks;
73
74/*
75 * ----------------------------------------------------------------------
76 *
77 * TickSweep --
78 *
79 * Structure containing information where the ticks (major or
80 * minor) will be displayed on the graph.
81 *
82 * ----------------------------------------------------------------------
83 */
84typedef struct {
85 double initial; /* Initial value */
86 double step; /* Size of interval */
87 int nSteps; /* Number of intervals. */
88} TickSweep;
89
90/*
91 * ----------------------------------------------------------------------
92 *
93 * Axis --
94 *
95 * Structure contains options controlling how the axis will be
96 * displayed.
97 *
98 * ----------------------------------------------------------------------
99 */
100typedef struct {
101 char *name; /* Identifier to refer the element.
102 * Used in the "insert", "delete", or
103 * "show", commands. */
104
105 Blt_Uid classUid; /* Type of axis. */
106
107 Graph *graphPtr; /* Graph widget of element*/
108
109 unsigned int flags; /* Set bit field definitions below */
110
111 /*
112 * AXIS_DRAWN Axis is designated as a logical axis
113 * AXIS_DIRTY
114 *
115 * AXIS_CONFIG_MAJOR User specified major ticks.
116 * AXIS_CONFIG_MINOR User specified minor ticks.
117 */
118
119 char **tags;
120
121 char *detail;
122
123 int deletePending; /* Indicates that the axis was
124 * scheduled for deletion. The actual
125 * deletion may be deferred until the
126 * axis is no longer in use. */
127
128 int refCount; /* Number of elements referencing this
129 * axis. */
130
131 Blt_HashEntry *hashPtr; /* Points to axis entry in hash
132 * table. Used to quickly remove axis
133 * entries. */
134
135 int logScale; /* If non-zero, scale the axis values
136 * logarithmically. */
137
138 int hidden; /* If non-zero, don't display the
139 * axis title, ticks, or line. */
140
141 int showTicks; /* If non-zero, display tick marks and
142 * labels. */
143
144 int descending; /* If non-zero, display the range of
145 * values on the axis in descending
146 * order, from high to low. */
147
148 int looseMin, looseMax; /* If non-zero, axis range extends to
149 * the outer major ticks, otherwise at
150 * the limits of the data values. This
151 * is overriddened by setting the -min
152 * and -max options. */
153
154 char *title; /* Title of the axis. */
155
156 TextStyle titleTextStyle; /* Text attributes (color, font,
157 * rotation, etc.) of the axis
158 * title. */
159
160 int titleAlternate; /* Indicates whether to position the
161 * title above/left of the axis. */
162
163 Point2D titlePos; /* Position of the title */
164
165 unsigned short int titleWidth, titleHeight;
166
167 int lineWidth; /* Width of lines representing axis
168 * (including ticks). If zero, then
169 * no axis lines or ticks are
170 * drawn. */
171
172 char **limitsFormats; /* One or two strings of sprintf-like
173 * formats describing how to display
174 * virtual axis limits. If NULL,
175 * display no limits. */
176 int nFormats;
177
178 TextStyle limitsTextStyle; /* Text attributes (color, font,
179 * rotation, etc.) of the limits. */
180
181 double windowSize; /* Size of a sliding window of values
182 * used to scale the axis automatically
183 * as new data values are added. The axis
184 * will always display the latest values
185 * in this range. */
186
187 double shiftBy; /* Shift maximum by this interval. */
188
189 int tickLength; /* Length of major ticks in pixels */
190
191 TextStyle tickTextStyle; /* Text attributes (color, font, rotation,
192 * etc.) for labels at each major tick. */
193
194 char *formatCmd; /* Specifies a Tcl command, to be invoked
195 * by the axis whenever it has to generate
196 * tick labels. */
197
198 char *scrollCmdPrefix;
199 int scrollUnits;
200
201 double min, max; /* The actual axis range. */
202
203 double reqMin, reqMax; /* Requested axis bounds. Consult the
204 * axisPtr->flags field for
205 * AXIS_CONFIG_MIN and AXIS_CONFIG_MAX
206 * to see if the requested bound have
207 * been set. They override the
208 * computed range of the axis
209 * (determined by auto-scaling). */
210
211 double scrollMin, scrollMax;/* Defines the scrolling reqion of the axis.
212 * Normally the region is determined from
213 * the data limits. If specified, these
214 * values override the data-range. */
215
216 AxisRange valueRange; /* Range of data values of elements mapped
217 * to this axis. This is used to auto-scale
218 * the axis in "tight" mode. */
219
220 AxisRange axisRange; /* Smallest and largest major tick values
221 * for the axis. The tick values lie outside
222 * the range of data values. This is used to
223 * auto-scale the axis in "loose" mode. */
224
225 double prevMin, prevMax;
226
227 double reqStep; /* If > 0.0, overrides the computed major
228 * tick interval. Otherwise a stepsize
229 * is automatically calculated, based
230 * upon the range of elements mapped to the
231 * axis. The default value is 0.0. */
232
233 double tickZoom; /* If > 0.0, overrides the computed major
234 * tick interval. Otherwise a stepsize
235 * is automatically calculated, based
236 * upon the range of elements mapped to the
237 * axis. The default value is 0.0. */
238
239
240 GC tickGC; /* Graphics context for axis and tick labels */
241
242 Ticks *t1Ptr; /* Array of major tick positions. May be
243 * set by the user or generated from the
244 * major sweep below. */
245
246 Ticks *t2Ptr; /* Array of minor tick positions. May be
247 * set by the user or generated from the
248 * minor sweep below. */
249
250 TickSweep minorSweep, majorSweep;
251
252 int reqNumMinorTicks; /* If non-zero, represents the
253 * requested the number of minor ticks
254 * to be uniformally displayed along
255 * each major tick. */
256
257
258 int labelOffset; /* If non-zero, indicates that the tick
259 * label should be offset to sit in the
260 * middle of the next interval. */
261
262 /* The following fields are specific to logical axes */
263
264 Blt_ChainLink *linkPtr; /* Axis link in margin list. */
265 Blt_Chain *chainPtr;
266
267 short int width, height; /* Extents of axis */
268
269 Segment2D *segments; /* Array of line segments representing
270 * the major and minor ticks, but also
271 * the axis line itself. The segment
272 * coordinates are relative to the
273 * axis. */
274
275 int nSegments; /* Number of segments in the above array. */
276
277 Blt_Chain *tickLabels; /* Contains major tick label strings
278 * and their offsets along the axis. */
279 Region2D region;
280
281 Tk_3DBorder border;
282 int borderWidth;
283 int relief;
284} Axis;
285
286#define AXIS_CONFIG_MAJOR (1<<4) /* User specified major tick intervals. */
287#define AXIS_CONFIG_MINOR (1<<5) /* User specified minor tick intervals. */
288#define AXIS_ONSCREEN (1<<6) /* Axis is displayed on the screen via
289 * the "use" operation */
290#define AXIS_DIRTY (1<<7)
291#define AXIS_ALLOW_NULL (1<<12)
292
293/*
294 * -------------------------------------------------------------------
295 *
296 * Axis2D --
297 *
298 * The pair of axes mapping a point onto the graph.
299 *
300 * -------------------------------------------------------------------
301 */
302typedef struct {
303 Axis *x, *y;
304} Axis2D;
305
306#endif /* _BLT_GR_AXIS_H */
Note: See TracBrowser for help on using the repository browser.