Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2
<HTML>
3
<HEAD>
4
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
5
<LINK REL="Start" HREF="index.html">
6
<LINK REL="Contents" HREF="toc.html">
7
<LINK REL="Prev" HREF="104Usingacanvasscale.html">
8
<LINK REL="Next" HREF="11AntiSpamChallenges.html">
9
<STYLE TYPE="text/css"><!--
10
BODY { font-family: serif }
11
H1 { font-family: sans-serif }
12
H2 { font-family: sans-serif }
13
H3 { font-family: sans-serif }
14
H4 { font-family: sans-serif }
15
H5 { font-family: sans-serif }
16
H6 { font-family: sans-serif }
17
SUB { font-size: smaller }
18
SUP { font-size: smaller }
19
PRE { font-family: monospace }
20
A { text-decoration: none }
21
--></STYLE>
22
</HEAD>
23
<BODY>
24
<A HREF="toc.html">Contents</A>
25
<A HREF="104Usingacanvasscale.html">Previous</A>
26
<A HREF="11AntiSpamChallenges.html">Next</A>
27
<HR NOSHADE>
28
<H2><A NAME="10_5">10.5 Sample application: Drawing DB schema</A></H2>
29
<P> As a final example we shortly discuss how the canvas type of graph
30
 was used to generate the DB schema for the DDDA architecture.</P>
31
<P> The library php file &quot;utils/misc/imgdbschema.php&quot; included in the
32
 distribution contains some utility classes to make the drawing of table
33
 schemes easier. It contains two basic classes, Class ImgDBTable and
34
 Class ImgDBSchema. The first class understand how to draw an image
35
 illustrating a single table. The second class is responsible for
36
 automatically extract all the relevant information from a DB to draw a
37
 complete DB Schema.</P>
38
<P> Before going into this a little bit more we show what an example of
39
 this might look like.<DIV class="example">
40
<BR> <A href="exframes/frame_dbschemaex1.html" target="blank"><IMG border="0"
41
HEIGHT="750"       src="img/img/img/img/img/img/dbschemaex1.png" WIDTH="600"></A>
42
<BR><B>Figure 194:</B> Example of using the canvas graph style together
43
 with the imgdbschema.php library to semi-automatically generate a DB
44
 schema <A href="exframes/frame_dbschemaex1.html" target="blank">[src]</A>
45
&nbsp;
46
<P></P>
47
</DIV></P>
48
<P></P>
49
<P> Before going on it should be noted that the ImgDBSchema assumes that
50
 the DB can be accessed through a DB abstraction layer modeled after the
51
 abstraction layer available in the 'jpdb.php' file in the DDDA
52
 architecture. This abstraction layer assumes a MySQL database in the
53
 bottom. This specific dependency of this particular abstraction layer
54
 is the reason why these classes is not included in the generic canvas
55
 tools file.</P>
56
<P> The second thing to note is that this library does not contain a
57
 complete automatic-layout engine but rather a very simple automatic
58
 system which, if nothing else is specified, just puts the table in a
59
 rectangular grid. A complete graph layout engine would simple be to
60
 much to write in this context. This is also a very difficult
61
 optimization problem and sofar not even any of the available research
62
 programs that tries this can achieve a satisfactory layout without
63
 manual intervention.</P>
64
<P> The critical lines in the code to generate the above graph is<DIV class="phpscript">
65
<CODE><FONT color="#000000"> <FONT color="#0000BB">&nbsp;$tblposadj</FONT><FONT
66
color="#007700">=array(</FONT><FONT color="#0000BB">$tlo</FONT><FONT color="#007700">
67
,</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT
68
color="#0000BB">$tblwidth</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">
69
$tlo</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">2</FONT><FONT
70
color="#007700">,</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">
71
,</FONT><FONT color="#0000BB">2</FONT><FONT color="#007700">*</FONT><FONT
72
color="#0000BB">$tblwidth</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">
73
$tlo</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">4</FONT><FONT
74
color="#007700">,</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">
75
,-</FONT><FONT color="#0000BB">1</FONT><FONT color="#007700">,</FONT><FONT
76
color="#0000BB">16</FONT><FONT color="#007700">,-</FONT><FONT color="#0000BB">
77
1</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">16</FONT><FONT
78
color="#007700">);
79
<BR></FONT><FONT color="#0000BB">$dbschema&nbsp;</FONT><FONT color="#007700">
80
=&nbsp;new&nbsp;</FONT><FONT color="#0000BB">ImgDBSchema</FONT><FONT color="#007700">
81
(</FONT><FONT color="#DD0000">&quot;jpgraph_doc&quot;</FONT><FONT color="#007700">
82
,</FONT><FONT color="#DD0000">&quot;FormatTblName&quot;</FONT><FONT color="#007700">
83
,</FONT><FONT color="#DD0000">&quot;FormatFldName&quot;</FONT><FONT color="#007700">
84
);
85
<BR></FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
86
-&gt;</FONT><FONT color="#0000BB">SetMargin</FONT><FONT color="#007700">(</FONT><FONT
87
color="#0000BB">$leftm</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
88
$topm</FONT><FONT color="#007700">);
89
<BR></FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
90
-&gt;</FONT><FONT color="#0000BB">SetTableWidth</FONT><FONT color="#007700">
91
(</FONT><FONT color="#0000BB">$tblwidth</FONT><FONT color="#007700">);
92
<BR></FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
93
-&gt;</FONT><FONT color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT
94
color="#0000BB">$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
95
img</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT
96
color="#007700">-&gt;</FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">
97
,</FONT><FONT color="#0000BB">$tblposadj</FONT><FONT color="#007700">);</FONT><FONT
98
color="#0000BB"></FONT></FONT></CODE></DIV></P>
99
<P></P>
100
<P> The rest of the code in the file is just to setup the canvas, add an
101
 indented rectangle to group some tables and generate a footer with the
102
 date and time this image was generated.</P>
103
<P> The first line instantiates a new ImgDBSCheme layout engine asking
104
 it to draw an image for the database 'jpgraph_doc'. The following two
105
 arguments specify two callback functions for formatting the text for
106
 header and each field in a table.</P>
107
<P> The next line specify the top left margin where the drawing of the
108
 tables should be started.</P>
109
<P> The third line specify the width of a single table. The final lines
110
 starts the engine and draws all tables in the database to the canvas.
111
 The final argument requires some further explanation. This is an offset
112
 (x,y) from the top left corner how each individual table should be
113
 positioned. If the value is -1 indicates that the default value should
114
 be used. If this array is not specified then the tables will simple
115
 arranged line by line.</P>
116
<P> The full source code for drawing this DB schema example is shown
117
 below.</P>
118
<P><DIV class="phpscript">(File: dbschemaex1.php)
119
<BR><CODE><FONT color="#000000"> <FONT color="#0000BB">&lt;?php
120
<BR></FONT><FONT color="#FF8000">
121
/*=======================================================================
122
<BR>//&nbsp;File:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBSCHEMAEX1.PHP
123
<BR>//&nbsp;Description:&nbsp;&nbsp;&nbsp;&nbsp;Draw&nbsp;a&nbsp;DB&nbsp;schema&nbsp;of&nbsp;the&nbsp;DDDA&nbsp;architecture
124
<BR>//&nbsp;Created:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2002-08-25
125
<BR>//&nbsp;Author:&nbsp;&nbsp;&nbsp;&nbsp;Johan&nbsp;Persson&nbsp;(johanp@aditus.nu)
126
<BR>
127
//&nbsp;Ver:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Id:&nbsp;dbschemaex1.php,v&nbsp;1.1&nbsp;2002/08/27&nbsp;20:08:57&nbsp;aditus&nbsp;Exp&nbsp;$
128
<BR>//
129
<BR>//&nbsp;License:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;code&nbsp;is&nbsp;released&nbsp;under&nbsp;QPL
130
<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copyright&nbsp;(C)&nbsp;2001,2002&nbsp;Johan&nbsp;Persson
131
<BR>
132
//&nbsp;Note:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;actual&nbsp;drawing&nbsp;of&nbsp;the&nbsp;tables&nbsp;are&nbsp;semi-automatically
133
<BR>
134
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;but&nbsp;you&nbsp;can&nbsp;easily&nbsp;adjust&nbsp;the&nbsp;individual&nbsp;tables&nbsp;position
135
<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with&nbsp;the&nbsp;'tblposadj'&nbsp;array.&nbsp;
136
<BR>//
137
<BR>
138
//========================================================================
139
<BR>*/
140
<BR></FONT><FONT color="#007700">include&nbsp;</FONT><FONT color="#DD0000">
141
&quot;../jpgraph.php&quot;</FONT><FONT color="#007700">;
142
<BR>include&nbsp;</FONT><FONT color="#DD0000">&quot;../jpgraph_canvas.php&quot;</FONT><FONT
143
color="#007700">;
144
<BR>include&nbsp;</FONT><FONT color="#DD0000">&quot;../jpgraph_canvtools.php&quot;</FONT><FONT
145
color="#007700">;
146
<BR>include&nbsp;</FONT><FONT color="#DD0000">&quot;../utils/misc/imgdbschema.inc&quot;</FONT><FONT
147
color="#007700">;
148
<BR>include&nbsp;</FONT><FONT color="#DD0000">&quot;../utils/jpdocgen/jpdb.php&quot;</FONT><FONT
149
color="#007700">;
150
<BR>
151
<BR>
152
<BR></FONT><FONT color="#FF8000">
153
//&nbsp;Global&nbsp;callback&nbsp;to&nbsp;format&nbsp;the&nbsp;table&nbsp;header&nbsp;names
154
<BR></FONT><FONT color="#007700">function&nbsp;</FONT><FONT color="#0000BB">
155
FormatTblName</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
156
$aName</FONT><FONT color="#007700">)&nbsp;{
157
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">
158
//&nbsp;We&nbsp;want&nbsp;to&nbsp;replace&nbsp;any&nbsp;specifi&nbsp;references&nbsp;to&nbsp;the
159
<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;'JpGraph'&nbsp;project&nbsp;with&nbsp;the&nbsp;generic&nbsp;'&lt;project&gt;'
160
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#007700">return&nbsp;</FONT><FONT color="#0000BB">
161
str_replace</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
162
'JpGraph'</FONT><FONT color="#007700">,</FONT><FONT color="#DD0000">
163
'&lt;project&gt;'</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">
164
$aName</FONT><FONT color="#007700">);
165
<BR>}
166
<BR>
167
<BR></FONT><FONT color="#FF8000">
168
//&nbsp;Global&nbsp;callback&nbsp;to&nbsp;format&nbsp;each&nbsp;field&nbsp;name&nbsp;in&nbsp;the&nbsp;table
169
<BR></FONT><FONT color="#007700">function&nbsp;</FONT><FONT color="#0000BB">
170
FormatFldName</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
171
$aName</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$aTable</FONT><FONT
172
color="#007700">)&nbsp;{
173
<BR>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</FONT><FONT color="#0000BB">$aName</FONT><FONT color="#007700">
174
;
175
<BR>}
176
<BR>
177
<BR>
178
<BR>class&nbsp;</FONT><FONT color="#0000BB">Driver&nbsp;</FONT><FONT color="#007700">
179
{
180
<BR>
181
<BR>&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</FONT><FONT color="#0000BB">$ig</FONT><FONT color="#007700">
182
,&nbsp;</FONT><FONT color="#0000BB">$img</FONT><FONT color="#007700">,&nbsp;</FONT><FONT
183
color="#0000BB">$iscale</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">
184
$ishape</FONT><FONT color="#007700">;
185
<BR>&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</FONT><FONT color="#0000BB">$iymax</FONT><FONT color="#007700">
186
,</FONT><FONT color="#0000BB">$ixmax</FONT><FONT color="#007700">;
187
<BR>&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</FONT><FONT color="#0000BB">$iwidth</FONT><FONT color="#007700">
188
,</FONT><FONT color="#0000BB">$iheight</FONT><FONT color="#007700">;
189
<BR>
190
<BR>&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;</FONT><FONT color="#0000BB">Driver</FONT><FONT color="#007700">
191
()&nbsp;{
192
<BR>
193
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">
194
//&nbsp;Define&nbsp;Image&nbsp;size&nbsp;and&nbsp;coordinate&nbsp;grid&nbsp;space&nbsp;to&nbsp;work&nbsp;within
195
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
196
-&gt;</FONT><FONT color="#0000BB">iwidth&nbsp;</FONT><FONT color="#007700">=&nbsp;</FONT><FONT
197
color="#0000BB">600</FONT><FONT color="#007700">;
198
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
199
-&gt;</FONT><FONT color="#0000BB">iheight</FONT><FONT color="#007700">=&nbsp;</FONT><FONT
200
color="#0000BB">750</FONT><FONT color="#007700">;
201
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
202
-&gt;</FONT><FONT color="#0000BB">iymax&nbsp;&nbsp;</FONT><FONT color="#007700">=&nbsp;</FONT><FONT
203
color="#0000BB">50</FONT><FONT color="#007700">;
204
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
205
-&gt;</FONT><FONT color="#0000BB">ixmax&nbsp;&nbsp;</FONT><FONT color="#007700">=&nbsp;</FONT><FONT
206
color="#0000BB">55</FONT><FONT color="#007700">;
207
<BR>
208
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">//&nbsp;Setup&nbsp;a&nbsp;basic&nbsp;canvas
209
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
210
-&gt;</FONT><FONT color="#0000BB">ig&nbsp;</FONT><FONT color="#007700">=&nbsp;new&nbsp;</FONT><FONT
211
color="#0000BB">CanvasGraph</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
212
$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">iwidth</FONT><FONT
213
color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
214
-&gt;</FONT><FONT color="#0000BB">iheight</FONT><FONT color="#007700">,</FONT><FONT
215
color="#DD0000">'auto'</FONT><FONT color="#007700">);
216
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
217
-&gt;</FONT><FONT color="#0000BB">img&nbsp;</FONT><FONT color="#007700">=&nbsp;</FONT><FONT
218
color="#0000BB">$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
219
ig</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">img</FONT><FONT
220
color="#007700">;
221
<BR>
222
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">//&nbsp;Define&nbsp;the&nbsp;scale&nbsp;to&nbsp;be&nbsp;used
223
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
224
-&gt;</FONT><FONT color="#0000BB">iscale&nbsp;</FONT><FONT color="#007700">
225
=&nbsp;new&nbsp;</FONT><FONT color="#0000BB">CanvasScale</FONT><FONT color="#007700">
226
(</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">-&gt;</FONT><FONT
227
color="#0000BB">ig</FONT><FONT color="#007700">);
228
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
229
-&gt;</FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">-&gt;</FONT><FONT
230
color="#0000BB">Set</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
231
0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT
232
color="#007700">-&gt;</FONT><FONT color="#0000BB">ixmax</FONT><FONT color="#007700">
233
,</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT
234
color="#0000BB">$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
235
iymax</FONT><FONT color="#007700">);
236
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
237
-&gt;</FONT><FONT color="#0000BB">ishape&nbsp;</FONT><FONT color="#007700">
238
=&nbsp;new&nbsp;</FONT><FONT color="#0000BB">Shape</FONT><FONT color="#007700">(</FONT><FONT
239
color="#0000BB">$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
240
ig</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT
241
color="#007700">-&gt;</FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">
242
);
243
<BR>
244
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">//&nbsp;A&nbsp;small&nbsp;frame&nbsp;around&nbsp;the&nbsp;canvas
245
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
246
-&gt;</FONT><FONT color="#0000BB">ig</FONT><FONT color="#007700">-&gt;</FONT><FONT
247
color="#0000BB">SetMargin</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
248
2</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">3</FONT><FONT
249
color="#007700">,</FONT><FONT color="#0000BB">2</FONT><FONT color="#007700">
250
,</FONT><FONT color="#0000BB">3</FONT><FONT color="#007700">);
251
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
252
-&gt;</FONT><FONT color="#0000BB">ig</FONT><FONT color="#007700">-&gt;</FONT><FONT
253
color="#0000BB">SetMarginColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
254
&quot;teal&quot;</FONT><FONT color="#007700">);
255
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
256
-&gt;</FONT><FONT color="#0000BB">ig</FONT><FONT color="#007700">-&gt;</FONT><FONT
257
color="#0000BB">InitFrame</FONT><FONT color="#007700">();
258
<BR>
259
<BR>&nbsp;&nbsp;&nbsp;&nbsp;}
260
<BR>
261
<BR>&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;</FONT><FONT color="#0000BB">Run</FONT><FONT color="#007700">
262
()&nbsp;{
263
<BR>
264
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$leftm</FONT><FONT color="#007700">
265
=</FONT><FONT color="#0000BB">1.5</FONT><FONT color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT
266
color="#FF8000">//&nbsp;Left&nbsp;margin&nbsp;(for&nbsp;table&nbsp;schemes)&nbsp;
267
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$topm</FONT><FONT color="#007700">=</FONT><FONT
268
color="#0000BB">5</FONT><FONT color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">
269
//&nbsp;Top&nbsp;margin&nbsp;(for&nbsp;table&nbsp;schemes)&nbsp;
270
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tblwidth</FONT><FONT color="#007700">
271
=</FONT><FONT color="#0000BB">15</FONT><FONT color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT
272
color="#FF8000">//&nbsp;Individual&nbsp;table&nbsp;width
273
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tlo</FONT><FONT color="#007700">=</FONT><FONT
274
color="#0000BB">1</FONT><FONT color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">
275
//&nbsp;Offset&nbsp;for&nbsp;top&nbsp;line
276
<BR>
277
<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Add&nbsp;the&nbsp;background&nbsp;color&nbsp;for&nbsp;the&nbsp;project&nbsp;specific&nbsp;tables
278
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
279
-&gt;</FONT><FONT color="#0000BB">ishape</FONT><FONT color="#007700">-&gt;</FONT><FONT
280
color="#0000BB">IndentedRectangle</FONT><FONT color="#007700">(</FONT><FONT
281
color="#0000BB">$leftm</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
282
$topm</FONT><FONT color="#007700">-</FONT><FONT color="#0000BB">1</FONT><FONT
283
color="#007700">,</FONT><FONT color="#0000BB">3</FONT><FONT color="#007700">
284
*</FONT><FONT color="#0000BB">$tblwidth</FONT><FONT color="#007700">+</FONT><FONT
285
color="#0000BB">$tlo</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">
286
6</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">45</FONT><FONT
287
color="#007700">,
288
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tlo</FONT><FONT color="#007700">
289
+</FONT><FONT color="#0000BB">2</FONT><FONT color="#007700">*</FONT><FONT
290
color="#0000BB">$tblwidth</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">
291
2</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">30</FONT><FONT
292
color="#007700">,</FONT><FONT color="#0000BB">CORNER_BOTTOMLEFT</FONT><FONT
293
color="#007700">,
294
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#DD0000">'lightblue'</FONT><FONT
295
color="#007700">);
296
<BR>
297
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">
298
//&nbsp;Stroke&nbsp;the&nbsp;tables&nbsp;(series&nbsp;of&nbsp;x,y&nbsp;offsets,&nbsp;If&nbsp;=-1&nbsp;then&nbsp;use&nbsp;the
299
<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;automtic&nbsp;positioning
300
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tblposadj</FONT><FONT color="#007700">
301
=array(</FONT><FONT color="#0000BB">$tlo</FONT><FONT color="#007700">,</FONT><FONT
302
color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
303
$tblwidth</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">$tlo</FONT><FONT
304
color="#007700">+</FONT><FONT color="#0000BB">2</FONT><FONT color="#007700">
305
,</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT
306
color="#0000BB">2</FONT><FONT color="#007700">*</FONT><FONT color="#0000BB">
307
$tblwidth</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">$tlo</FONT><FONT
308
color="#007700">+</FONT><FONT color="#0000BB">4</FONT><FONT color="#007700">
309
,
310
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">
311
,-</FONT><FONT color="#0000BB">1</FONT><FONT color="#007700">,</FONT><FONT
312
color="#0000BB">16</FONT><FONT color="#007700">,-</FONT><FONT color="#0000BB">
313
1</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">16</FONT><FONT
314
color="#007700">);
315
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$dbschema&nbsp;</FONT><FONT color="#007700">
316
=&nbsp;new&nbsp;</FONT><FONT color="#0000BB">ImgDBSchema</FONT><FONT color="#007700">
317
(</FONT><FONT color="#DD0000">'jpgraph_doc'</FONT><FONT color="#007700">
318
,</FONT><FONT color="#DD0000">'FormatTblName'</FONT><FONT color="#007700">
319
,</FONT><FONT color="#DD0000">'FormatFldName'</FONT><FONT color="#007700">
320
);
321
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
322
-&gt;</FONT><FONT color="#0000BB">SetMargin</FONT><FONT color="#007700">(</FONT><FONT
323
color="#0000BB">$leftm</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
324
$topm</FONT><FONT color="#007700">);
325
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
326
-&gt;</FONT><FONT color="#0000BB">SetTableWidth</FONT><FONT color="#007700">
327
(</FONT><FONT color="#0000BB">$tblwidth</FONT><FONT color="#007700">);
328
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
329
-&gt;</FONT><FONT color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT
330
color="#0000BB">$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
331
img</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT
332
color="#007700">-&gt;</FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">
333
,</FONT><FONT color="#0000BB">$tblposadj</FONT><FONT color="#007700">);
334
<BR>
335
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt&nbsp;</FONT><FONT color="#007700">
336
=&nbsp;new&nbsp;</FONT><FONT color="#0000BB">CanvasRectangleText</FONT><FONT color="#007700">
337
();
338
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
339
color="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
340
''</FONT><FONT color="#007700">);
341
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
342
color="#0000BB">SetColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
343
''</FONT><FONT color="#007700">);
344
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
345
color="#0000BB">SetFontColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
346
'navy'</FONT><FONT color="#007700">);
347
<BR>
348
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">//&nbsp;Add&nbsp;explanation
349
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
350
color="#0000BB">SetFont</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
351
FF_ARIAL</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
352
FS_NORMAL</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">12</FONT><FONT
353
color="#007700">);
354
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
355
color="#0000BB">Set</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
356
'Project&nbsp;specific&nbsp;tables'</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
357
$tblwidth</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">
358
$leftm</FONT><FONT color="#007700">+</FONT><FONT color="#0000BB">3</FONT><FONT
359
color="#007700">,</FONT><FONT color="#0000BB">16</FONT><FONT color="#007700">
360
,</FONT><FONT color="#0000BB">15</FONT><FONT color="#007700">);
361
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
362
color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
363
$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">img</FONT><FONT
364
color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
365
-&gt;</FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">);
366
<BR>
367
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">//&nbsp;Add&nbsp;title
368
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
369
color="#0000BB">SetColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
370
''</FONT><FONT color="#007700">);
371
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
372
color="#0000BB">SetFont</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
373
FF_VERDANA</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
374
FS_BOLD</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">26</FONT><FONT
375
color="#007700">);
376
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
377
color="#0000BB">Set</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
378
'DDDA&nbsp;-&nbsp;DB&nbsp;Schema'</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
379
9</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">0.5</FONT><FONT
380
color="#007700">,</FONT><FONT color="#0000BB">30</FONT><FONT color="#007700">
381
);
382
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
383
color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
384
$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">img</FONT><FONT
385
color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
386
-&gt;</FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">);
387
<BR>
388
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#FF8000">//&nbsp;Add&nbsp;a&nbsp;version&nbsp;and&nbsp;date
389
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
390
color="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
391
'yellow'</FONT><FONT color="#007700">);
392
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
393
color="#0000BB">SetFont</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
394
FF_FONT1</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
395
FS_NORMAL</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">10</FONT><FONT
396
color="#007700">);
397
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
398
color="#0000BB">Set</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
399
&quot;Generated:&nbsp;&quot;</FONT><FONT color="#007700">.</FONT><FONT color="#0000BB">
400
date</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">&quot;ymd&nbsp;H:i&quot;</FONT><FONT
401
color="#007700">,</FONT><FONT color="#0000BB">time</FONT><FONT color="#007700">
402
()),</FONT><FONT color="#0000BB">1</FONT><FONT color="#007700">,</FONT><FONT
403
color="#0000BB">$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
404
iymax</FONT><FONT color="#007700">*</FONT><FONT color="#0000BB">0.96</FONT><FONT
405
color="#007700">,</FONT><FONT color="#0000BB">15</FONT><FONT color="#007700">
406
);&nbsp;
407
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-&gt;</FONT><FONT
408
color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
409
$this</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">img</FONT><FONT
410
color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
411
-&gt;</FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">);
412
<BR>
413
<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
414
-&gt;</FONT><FONT color="#0000BB">ig</FONT><FONT color="#007700">-&gt;</FONT><FONT
415
color="#0000BB">Stroke</FONT><FONT color="#007700">();
416
<BR>&nbsp;&nbsp;&nbsp;&nbsp;}
417
<BR>}
418
<BR>
419
<BR></FONT><FONT color="#0000BB">$driver&nbsp;</FONT><FONT color="#007700">
420
=&nbsp;new&nbsp;</FONT><FONT color="#0000BB">Driver</FONT><FONT color="#007700">
421
();
422
<BR></FONT><FONT color="#0000BB">$driver</FONT><FONT color="#007700">-&gt;</FONT><FONT
423
color="#0000BB">Run</FONT><FONT color="#007700">();
424
<BR>
425
<BR></FONT><FONT color="#0000BB">?&gt;
426
<BR></FONT>
427
<BR></FONT></CODE></DIV></P>
428
<HR NOSHADE>
429
<A HREF="toc.html">Contents</A>
430
<A HREF="104Usingacanvasscale.html">Previous</A>
431
<A HREF="11AntiSpamChallenges.html">Next</A>
432
</BODY>
433
</HTML>