| 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 "utils/misc/imgdbschema.php" 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 |
|
|
|
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"> $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 </FONT><FONT color="#007700">
|
|
|
80 |
= new </FONT><FONT color="#0000BB">ImgDBSchema</FONT><FONT color="#007700">
|
|
|
81 |
(</FONT><FONT color="#DD0000">"jpgraph_doc"</FONT><FONT color="#007700">
|
|
|
82 |
,</FONT><FONT color="#DD0000">"FormatTblName"</FONT><FONT color="#007700">
|
|
|
83 |
,</FONT><FONT color="#DD0000">"FormatFldName"</FONT><FONT color="#007700">
|
|
|
84 |
);
|
|
|
85 |
<BR></FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
|
|
|
86 |
-></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 |
-></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 |
-></FONT><FONT color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT
|
|
|
94 |
color="#0000BB">$this</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">
|
|
|
95 |
img</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT
|
|
|
96 |
color="#007700">-></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"><?php
|
|
|
120 |
<BR></FONT><FONT color="#FF8000">
|
|
|
121 |
/*=======================================================================
|
|
|
122 |
<BR>// File: DBSCHEMAEX1.PHP
|
|
|
123 |
<BR>// Description: Draw a DB schema of the DDDA architecture
|
|
|
124 |
<BR>// Created: 2002-08-25
|
|
|
125 |
<BR>// Author: Johan Persson (johanp@aditus.nu)
|
|
|
126 |
<BR>
|
|
|
127 |
// Ver: $Id: dbschemaex1.php,v 1.1 2002/08/27 20:08:57 aditus Exp $
|
|
|
128 |
<BR>//
|
|
|
129 |
<BR>// License: This code is released under QPL
|
|
|
130 |
<BR>// Copyright (C) 2001,2002 Johan Persson
|
|
|
131 |
<BR>
|
|
|
132 |
// Note: The actual drawing of the tables are semi-automatically
|
|
|
133 |
<BR>
|
|
|
134 |
// but you can easily adjust the individual tables position
|
|
|
135 |
<BR>// with the 'tblposadj' array.
|
|
|
136 |
<BR>//
|
|
|
137 |
<BR>
|
|
|
138 |
//========================================================================
|
|
|
139 |
<BR>*/
|
|
|
140 |
<BR></FONT><FONT color="#007700">include </FONT><FONT color="#DD0000">
|
|
|
141 |
"../jpgraph.php"</FONT><FONT color="#007700">;
|
|
|
142 |
<BR>include </FONT><FONT color="#DD0000">"../jpgraph_canvas.php"</FONT><FONT
|
|
|
143 |
color="#007700">;
|
|
|
144 |
<BR>include </FONT><FONT color="#DD0000">"../jpgraph_canvtools.php"</FONT><FONT
|
|
|
145 |
color="#007700">;
|
|
|
146 |
<BR>include </FONT><FONT color="#DD0000">"../utils/misc/imgdbschema.inc"</FONT><FONT
|
|
|
147 |
color="#007700">;
|
|
|
148 |
<BR>include </FONT><FONT color="#DD0000">"../utils/jpdocgen/jpdb.php"</FONT><FONT
|
|
|
149 |
color="#007700">;
|
|
|
150 |
<BR>
|
|
|
151 |
<BR>
|
|
|
152 |
<BR></FONT><FONT color="#FF8000">
|
|
|
153 |
// Global callback to format the table header names
|
|
|
154 |
<BR></FONT><FONT color="#007700">function </FONT><FONT color="#0000BB">
|
|
|
155 |
FormatTblName</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
|
|
|
156 |
$aName</FONT><FONT color="#007700">) {
|
|
|
157 |
<BR> </FONT><FONT color="#FF8000">
|
|
|
158 |
// We want to replace any specifi references to the
|
|
|
159 |
<BR> // 'JpGraph' project with the generic '<project>'
|
|
|
160 |
<BR> </FONT><FONT color="#007700">return </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 |
'<project>'</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
164 |
$aName</FONT><FONT color="#007700">);
|
|
|
165 |
<BR>}
|
|
|
166 |
<BR>
|
|
|
167 |
<BR></FONT><FONT color="#FF8000">
|
|
|
168 |
// Global callback to format each field name in the table
|
|
|
169 |
<BR></FONT><FONT color="#007700">function </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">) {
|
|
|
173 |
<BR> return </FONT><FONT color="#0000BB">$aName</FONT><FONT color="#007700">
|
|
|
174 |
;
|
|
|
175 |
<BR>}
|
|
|
176 |
<BR>
|
|
|
177 |
<BR>
|
|
|
178 |
<BR>class </FONT><FONT color="#0000BB">Driver </FONT><FONT color="#007700">
|
|
|
179 |
{
|
|
|
180 |
<BR>
|
|
|
181 |
<BR> var </FONT><FONT color="#0000BB">$ig</FONT><FONT color="#007700">
|
|
|
182 |
, </FONT><FONT color="#0000BB">$img</FONT><FONT color="#007700">, </FONT><FONT
|
|
|
183 |
color="#0000BB">$iscale</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
184 |
$ishape</FONT><FONT color="#007700">;
|
|
|
185 |
<BR> var </FONT><FONT color="#0000BB">$iymax</FONT><FONT color="#007700">
|
|
|
186 |
,</FONT><FONT color="#0000BB">$ixmax</FONT><FONT color="#007700">;
|
|
|
187 |
<BR> var </FONT><FONT color="#0000BB">$iwidth</FONT><FONT color="#007700">
|
|
|
188 |
,</FONT><FONT color="#0000BB">$iheight</FONT><FONT color="#007700">;
|
|
|
189 |
<BR>
|
|
|
190 |
<BR> function </FONT><FONT color="#0000BB">Driver</FONT><FONT color="#007700">
|
|
|
191 |
() {
|
|
|
192 |
<BR>
|
|
|
193 |
<BR> </FONT><FONT color="#FF8000">
|
|
|
194 |
// Define Image size and coordinate grid space to work within
|
|
|
195 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
196 |
-></FONT><FONT color="#0000BB">iwidth </FONT><FONT color="#007700">= </FONT><FONT
|
|
|
197 |
color="#0000BB">600</FONT><FONT color="#007700">;
|
|
|
198 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
199 |
-></FONT><FONT color="#0000BB">iheight</FONT><FONT color="#007700">= </FONT><FONT
|
|
|
200 |
color="#0000BB">750</FONT><FONT color="#007700">;
|
|
|
201 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
202 |
-></FONT><FONT color="#0000BB">iymax </FONT><FONT color="#007700">= </FONT><FONT
|
|
|
203 |
color="#0000BB">50</FONT><FONT color="#007700">;
|
|
|
204 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
205 |
-></FONT><FONT color="#0000BB">ixmax </FONT><FONT color="#007700">= </FONT><FONT
|
|
|
206 |
color="#0000BB">55</FONT><FONT color="#007700">;
|
|
|
207 |
<BR>
|
|
|
208 |
<BR> </FONT><FONT color="#FF8000">// Setup a basic canvas
|
|
|
209 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
210 |
-></FONT><FONT color="#0000BB">ig </FONT><FONT color="#007700">= new </FONT><FONT
|
|
|
211 |
color="#0000BB">CanvasGraph</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
|
|
|
212 |
$this</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">iwidth</FONT><FONT
|
|
|
213 |
color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
214 |
-></FONT><FONT color="#0000BB">iheight</FONT><FONT color="#007700">,</FONT><FONT
|
|
|
215 |
color="#DD0000">'auto'</FONT><FONT color="#007700">);
|
|
|
216 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
217 |
-></FONT><FONT color="#0000BB">img </FONT><FONT color="#007700">= </FONT><FONT
|
|
|
218 |
color="#0000BB">$this</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">
|
|
|
219 |
ig</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">img</FONT><FONT
|
|
|
220 |
color="#007700">;
|
|
|
221 |
<BR>
|
|
|
222 |
<BR> </FONT><FONT color="#FF8000">// Define the scale to be used
|
|
|
223 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
224 |
-></FONT><FONT color="#0000BB">iscale </FONT><FONT color="#007700">
|
|
|
225 |
= new </FONT><FONT color="#0000BB">CanvasScale</FONT><FONT color="#007700">
|
|
|
226 |
(</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
227 |
color="#0000BB">ig</FONT><FONT color="#007700">);
|
|
|
228 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
229 |
-></FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">-></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">-></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">-></FONT><FONT color="#0000BB">
|
|
|
235 |
iymax</FONT><FONT color="#007700">);
|
|
|
236 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
237 |
-></FONT><FONT color="#0000BB">ishape </FONT><FONT color="#007700">
|
|
|
238 |
= new </FONT><FONT color="#0000BB">Shape</FONT><FONT color="#007700">(</FONT><FONT
|
|
|
239 |
color="#0000BB">$this</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">
|
|
|
240 |
ig</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT
|
|
|
241 |
color="#007700">-></FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">
|
|
|
242 |
);
|
|
|
243 |
<BR>
|
|
|
244 |
<BR> </FONT><FONT color="#FF8000">// A small frame around the canvas
|
|
|
245 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
246 |
-></FONT><FONT color="#0000BB">ig</FONT><FONT color="#007700">-></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> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
252 |
-></FONT><FONT color="#0000BB">ig</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
253 |
color="#0000BB">SetMarginColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
254 |
"teal"</FONT><FONT color="#007700">);
|
|
|
255 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
256 |
-></FONT><FONT color="#0000BB">ig</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
257 |
color="#0000BB">InitFrame</FONT><FONT color="#007700">();
|
|
|
258 |
<BR>
|
|
|
259 |
<BR> }
|
|
|
260 |
<BR>
|
|
|
261 |
<BR> function </FONT><FONT color="#0000BB">Run</FONT><FONT color="#007700">
|
|
|
262 |
() {
|
|
|
263 |
<BR>
|
|
|
264 |
<BR> </FONT><FONT color="#0000BB">$leftm</FONT><FONT color="#007700">
|
|
|
265 |
=</FONT><FONT color="#0000BB">1.5</FONT><FONT color="#007700">; </FONT><FONT
|
|
|
266 |
color="#FF8000">// Left margin (for table schemes)
|
|
|
267 |
<BR> </FONT><FONT color="#0000BB">$topm</FONT><FONT color="#007700">=</FONT><FONT
|
|
|
268 |
color="#0000BB">5</FONT><FONT color="#007700">; </FONT><FONT color="#FF8000">
|
|
|
269 |
// Top margin (for table schemes)
|
|
|
270 |
<BR> </FONT><FONT color="#0000BB">$tblwidth</FONT><FONT color="#007700">
|
|
|
271 |
=</FONT><FONT color="#0000BB">15</FONT><FONT color="#007700">; </FONT><FONT
|
|
|
272 |
color="#FF8000">// Individual table width
|
|
|
273 |
<BR> </FONT><FONT color="#0000BB">$tlo</FONT><FONT color="#007700">=</FONT><FONT
|
|
|
274 |
color="#0000BB">1</FONT><FONT color="#007700">; </FONT><FONT color="#FF8000">
|
|
|
275 |
// Offset for top line
|
|
|
276 |
<BR>
|
|
|
277 |
<BR> // Add the background color for the project specific tables
|
|
|
278 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
279 |
-></FONT><FONT color="#0000BB">ishape</FONT><FONT color="#007700">-></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> </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> </FONT><FONT color="#DD0000">'lightblue'</FONT><FONT
|
|
|
295 |
color="#007700">);
|
|
|
296 |
<BR>
|
|
|
297 |
<BR> </FONT><FONT color="#FF8000">
|
|
|
298 |
// Stroke the tables (series of x,y offsets, If =-1 then use the
|
|
|
299 |
<BR> // automtic positioning
|
|
|
300 |
<BR> </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> </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> </FONT><FONT color="#0000BB">$dbschema </FONT><FONT color="#007700">
|
|
|
316 |
= new </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> </FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
|
|
|
322 |
-></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> </FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
|
|
|
326 |
-></FONT><FONT color="#0000BB">SetTableWidth</FONT><FONT color="#007700">
|
|
|
327 |
(</FONT><FONT color="#0000BB">$tblwidth</FONT><FONT color="#007700">);
|
|
|
328 |
<BR> </FONT><FONT color="#0000BB">$dbschema</FONT><FONT color="#007700">
|
|
|
329 |
-></FONT><FONT color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT
|
|
|
330 |
color="#0000BB">$this</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">
|
|
|
331 |
img</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT
|
|
|
332 |
color="#007700">-></FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">
|
|
|
333 |
,</FONT><FONT color="#0000BB">$tblposadj</FONT><FONT color="#007700">);
|
|
|
334 |
<BR>
|
|
|
335 |
<BR> </FONT><FONT color="#0000BB">$tt </FONT><FONT color="#007700">
|
|
|
336 |
= new </FONT><FONT color="#0000BB">CanvasRectangleText</FONT><FONT color="#007700">
|
|
|
337 |
();
|
|
|
338 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
339 |
color="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
340 |
''</FONT><FONT color="#007700">);
|
|
|
341 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
342 |
color="#0000BB">SetColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
343 |
''</FONT><FONT color="#007700">);
|
|
|
344 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
345 |
color="#0000BB">SetFontColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
346 |
'navy'</FONT><FONT color="#007700">);
|
|
|
347 |
<BR>
|
|
|
348 |
<BR> </FONT><FONT color="#FF8000">// Add explanation
|
|
|
349 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></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> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
355 |
color="#0000BB">Set</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
356 |
'Project specific 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> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
362 |
color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
|
|
|
363 |
$this</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">img</FONT><FONT
|
|
|
364 |
color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
365 |
-></FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">);
|
|
|
366 |
<BR>
|
|
|
367 |
<BR> </FONT><FONT color="#FF8000">// Add title
|
|
|
368 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
369 |
color="#0000BB">SetColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
370 |
''</FONT><FONT color="#007700">);
|
|
|
371 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></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> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
377 |
color="#0000BB">Set</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
378 |
'DDDA - DB 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> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
383 |
color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
|
|
|
384 |
$this</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">img</FONT><FONT
|
|
|
385 |
color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
386 |
-></FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">);
|
|
|
387 |
<BR>
|
|
|
388 |
<BR> </FONT><FONT color="#FF8000">// Add a version and date
|
|
|
389 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
390 |
color="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
391 |
'yellow'</FONT><FONT color="#007700">);
|
|
|
392 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></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> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
398 |
color="#0000BB">Set</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
399 |
"Generated: "</FONT><FONT color="#007700">.</FONT><FONT color="#0000BB">
|
|
|
400 |
date</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"ymd H:i"</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">-></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 |
);
|
|
|
407 |
<BR> </FONT><FONT color="#0000BB">$tt</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
408 |
color="#0000BB">Stroke</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
|
|
|
409 |
$this</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">img</FONT><FONT
|
|
|
410 |
color="#007700">,</FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
411 |
-></FONT><FONT color="#0000BB">iscale</FONT><FONT color="#007700">);
|
|
|
412 |
<BR>
|
|
|
413 |
<BR> </FONT><FONT color="#0000BB">$this</FONT><FONT color="#007700">
|
|
|
414 |
-></FONT><FONT color="#0000BB">ig</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
415 |
color="#0000BB">Stroke</FONT><FONT color="#007700">();
|
|
|
416 |
<BR> }
|
|
|
417 |
<BR>}
|
|
|
418 |
<BR>
|
|
|
419 |
<BR></FONT><FONT color="#0000BB">$driver </FONT><FONT color="#007700">
|
|
|
420 |
= new </FONT><FONT color="#0000BB">Driver</FONT><FONT color="#007700">
|
|
|
421 |
();
|
|
|
422 |
<BR></FONT><FONT color="#0000BB">$driver</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
423 |
color="#0000BB">Run</FONT><FONT color="#007700">();
|
|
|
424 |
<BR>
|
|
|
425 |
<BR></FONT><FONT color="#0000BB">?>
|
|
|
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>
|