Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<style type="text/css">
2
		<!--
3
		A:link        {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
4
		A:visited     {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
5
		A:hover       {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: underline; color: #FF0000}
6
		th            {font-family: helvetica, arial; color : blue; font-size:85%; background : lightgrey; border-right:black solid 1pt; border-bottom:black solid 1pt;}
7
		//-->
8
		</style><hr><a name="_C_GRAPH"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>Graph</b></div>
9
<i>(Defined in: jpgraph.php : 457)</i><table border=1><tr><td>&nbsp;<a href="Graph.html" style="font-family:arial;font-weight:bold;color:darkblue;">Graph</a>&nbsp;</td></tr><tr><td valign=top>&nbsp;<a href="Graph.html#_GRAPH_ADD">Add()</a>&nbsp;<br>
10
&nbsp;<a href="Graph.html#_GRAPH_ADDBAND">AddBand()</a>&nbsp;<br>
11
&nbsp;<a href="Graph.html#_GRAPH_ADDLINE">AddLine()</a>&nbsp;<br>
12
&nbsp;<a href="Graph.html#_GRAPH_ADDTEXT">AddText()</a>&nbsp;<br>
13
&nbsp;<a href="Graph.html#_GRAPH_ADDY">AddY()</a>&nbsp;<br>
14
&nbsp;<a href="Graph.html#_GRAPH_ADDY2">AddY2()</a>&nbsp;<br>
15
&nbsp;<a href="Graph.html#_GRAPH_CHECKCSIMCACHE">CheckCSIMCache()</a>&nbsp;<br>
16
&nbsp;<a href="Graph.html#_GRAPH_GETHTMLIMAGEMAP">GetHTMLImageMap()</a>&nbsp;<br>
17
&nbsp;<a href="Graph.html#_GRAPH_GRAPH">Graph()</a>&nbsp;<br>
18
&nbsp;<a href="Graph.html#_GRAPH_SET3DPERSPECTIVE">Set3DPerspective()</a>&nbsp;<br>
19
&nbsp;<a href="Graph.html#_GRAPH_SET90ANDMARGIN">Set90AndMargin()</a>&nbsp;<br>
20
&nbsp;<a href="Graph.html#_GRAPH_SETALPHABLENDING">SetAlphaBlending()</a>&nbsp;<br>
21
&nbsp;<a href="Graph.html#_GRAPH_SETANGLE">SetAngle()</a>&nbsp;<br>
22
&nbsp;<a href="Graph.html#_GRAPH_SETAXISLABELBACKGROUND">SetAxisLabelBackground()</a>&nbsp;<br>
23
&nbsp;<a href="Graph.html#_GRAPH_SETAXISSTYLE">SetAxisStyle()</a>&nbsp;<br>
24
&nbsp;<a href="Graph.html#_GRAPH_SETBACKGROUNDCFLAG">SetBackgroundCFlag()</a>&nbsp;<br>
25
&nbsp;<a href="Graph.html#_GRAPH_SETBACKGROUNDCOUNTRYFLAG">SetBackgroundCountryFlag()</a>&nbsp;<br>
26
&nbsp;<a href="Graph.html#_GRAPH_SETBACKGROUNDGRADIENT">SetBackgroundGradient()</a>&nbsp;<br>
27
&nbsp;<a href="Graph.html#_GRAPH_SETBACKGROUNDIMAGE">SetBackgroundImage()</a>&nbsp;<br>
28
&nbsp;<a href="Graph.html#_GRAPH_SETBACKGROUNDIMAGEMIX">SetBackgroundImageMix()</a>&nbsp;<br>
29
&nbsp;<a href="Graph.html#_GRAPH_SETBOX">SetBox()</a>&nbsp;<br>
30
&nbsp;<a href="Graph.html#_GRAPH_SETCLIPPING">SetClipping()</a>&nbsp;<br>
31
&nbsp;<a href="Graph.html#_GRAPH_SETCOLOR">SetColor()</a>&nbsp;<br>
32
&nbsp;<a href="Graph.html#_GRAPH_SETCSIMIMGALT">SetCSIMImgAlt()</a>&nbsp;<br>
33
&nbsp;<a href="Graph.html#_GRAPH_SETFRAME">SetFrame()</a>&nbsp;<br>
34
&nbsp;<a href="Graph.html#_GRAPH_SETFRAMEBEVEL">SetFrameBevel()</a>&nbsp;<br>
35
&nbsp;<a href="Graph.html#_GRAPH_SETGRIDDEPTH">SetGridDepth()</a>&nbsp;<br>
36
&nbsp;<a href="Graph.html#_GRAPH_SETICONDEPTH">SetIconDepth()</a>&nbsp;<br>
37
&nbsp;<a href="Graph.html#_GRAPH_SETIMGFORMAT">SetImgFormat()</a>&nbsp;<br>
38
&nbsp;<a href="Graph.html#_GRAPH_SETMARGIN">SetMargin()</a>&nbsp;<br>
39
&nbsp;<a href="Graph.html#_GRAPH_SETMARGINCOLOR">SetMarginColor()</a>&nbsp;<br>
40
&nbsp;<a href="Graph.html#_GRAPH_SETSCALE">SetScale()</a>&nbsp;<br>
41
&nbsp;<a href="Graph.html#_GRAPH_SETSHADOW">SetShadow()</a>&nbsp;<br>
42
&nbsp;<a href="Graph.html#_GRAPH_SETTEXTSCALEABSCENTEROFF">SetTextScaleAbsCenterOff()</a>&nbsp;<br>
43
&nbsp;<a href="Graph.html#_GRAPH_SETTICKDENSITY">SetTickDensity()</a>&nbsp;<br>
44
&nbsp;<a href="Graph.html#_GRAPH_SETTITLEBACKGROUND">SetTitleBackground()</a>&nbsp;<br>
45
&nbsp;<a href="Graph.html#_GRAPH_SETTITLEBACKGROUNDFILLSTYLE">SetTitleBackgroundFillStyle()</a>&nbsp;<br>
46
&nbsp;<a href="Graph.html#_GRAPH_SETY2ORDERBACK">SetY2OrderBack()</a>&nbsp;<br>
47
&nbsp;<a href="Graph.html#_GRAPH_SETY2SCALE">SetY2Scale()</a>&nbsp;<br>
48
&nbsp;<a href="Graph.html#_GRAPH_SETYDELTADIST">SetYDeltaDist()</a>&nbsp;<br>
49
&nbsp;<a href="Graph.html#_GRAPH_SETYSCALE">SetYScale()</a>&nbsp;<br>
50
&nbsp;<a href="Graph.html#_GRAPH_STROKE">Stroke()</a>&nbsp;<br>
51
&nbsp;<a href="Graph.html#_GRAPH_STROKECSIM">StrokeCSIM()</a>&nbsp;<br>
52
&nbsp;<a href="Graph.html#_GRAPH_STROKEFRAMEBACKGROUND">StrokeFrameBackground()</a>&nbsp;<br>
53
</td></tr></table>&nbsp;<p><div style="font-weight:bold;font-family:arial;font-size:100%;">Class usage and Overview</div>The Graph class is the main container class for all x,y-axis based plots which controls the creation of the entire graph. You must always instantiate one instance to create a graph. Through this class one controls many overall settings of the image displayed.
54
<p>
55
Please note that to create Pie, Gantt, Canvas and Spider charts you have to use their respective creation classes.
56
<p>
57
Public properties:
58
<table width=80% border=1>
59
<tr><th width=20%>Name</th><th width=20%>Type</th><th>Description</th></tr>
60
<tr>
61
<td>xaxis</td>
62
<td>Axis</td>
63
<td>X-axis</td>
64
</tr>
65
<tr>
66
<td>yaxis</td>
67
<td>Axis</td>
68
<td>Y-axis</td>
69
</tr>
70
<tr>
71
<td>xgrid</td>
72
<td>Grid</td>
73
<td>Grid lines for X-axis</td>
74
</tr>
75
<tr>
76
<td>ygrid</td>
77
<td>Grid</td>
78
<td>Grid lines for Y-axis</td>
79
</tr>
80
<tr>
81
<td>legend</td>
82
<td>Legend</td>
83
<td>Properties for legend box</td>
84
</tr>
85
<tr>
86
<td>title</td>
87
<td>Text</td>
88
<td>Graph main title</td>
89
</tr>
90
<tr>
91
<td>subtitle</td>
92
<td>Text</td>
93
<td>Sub title</td>
94
</tr>
95
<tr>
96
<td>subsubtitle</td>
97
<td>Text</td>
98
<td>Sub title</td>
99
<tr>
100
<tr>
101
<td>tabtitle</td>
102
<td>GraphTabTitle</td>
103
<td>Option Tab title for graph</td>
104
</tr>
105
 
106
<tr>
107
<td>img</td>
108
<td>RotImage</td>
109
<td>The image canvas</td>
110
</tr>
111
</table>
112
 <p> &nbsp;
113
<div style="font-weight:bold;font-family:arial;font-size:85%;">See also related classes:</div><a href="Axis.html">Axis</a>, <a href="Grid.html">Grid</a>, <a href="Text.html">Text</a> and <a href="Image.html">Image</a> <p> &nbsp;<hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p>
114
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_ADD"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
115
function&nbsp;Add(&amp;$aPlot)</font>
116
</b></div></a></span>
117
 
118
<span style='font-family:arial;font-size:90%;'><i>Add any plot object to the graph</i></span><p>
119
 
120
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
121
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
122
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
123
&amp;$aPlot</font>
124
 
125
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Plot object</td></tr>
126
</table>
127
 
128
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Each plot that should be displayed within the graph has to be added to the graph. This is the main method to add object. You can use this method to add
129
<ul>
130
<li> Plots
131
<li> Texts
132
<li> Plot lines
133
<li> Plot bands
134
</ul>
135
 
136
This method will add a plopt for use with the ?Left? Y-scale, (the normal Y scale). To add a plot to the second Y scale you should use AddY2().
137
<p>
138
Note that since the plot is added as a reference any changes you make to the original plot will also happen to the plot you have added to the graph.
139
<p>
140
Add() will always add plots to the first Y-scale. If you are using two Y-axis then you must use AddY2() to add plots to the second Y-scale.
141
&nbsp;<br>
142
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_ADDY2">Graph::AddY2</a> and <a href="Graph.html#_GRAPH_SETSCALE">Graph::SetScale</a>
143
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
144
$graph&nbsp;=&nbsp;new&nbsp;Graph(300,200,"auto");&nbsp;&nbsp;&nbsp;&nbsp;
<br />$graph-&gt;img-&gt;SetMargin(40,30,20,40);
<br />$graph-&gt;SetScale("textlin");
<br />$graph-&gt;SetShadow();
<br />
<br />//&nbsp;Create&nbsp;a&nbsp;bar&nbsp;pot
<br />$bplot&nbsp;=&nbsp;new&nbsp;BarPlot($datay);
<br />$bplot-&gt;SetFillColor("orange");
<br />$graph-&gt;Add($bplot);
<br />
<br />//&nbsp;Display&nbsp;the&nbsp;graph
<br />$graph-&gt;Stroke();
<br /></font>
145
</span><br>
146
<p>
147
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_ADDBAND"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
148
function&nbsp;AddBand(&amp;$aBand,$aToY2)</font>
149
</b></div></a></span>
150
151
<span style='font-family:arial;font-size:90%;'><i>Add vertical or horizontal band</i></span><p>
152
153
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
154
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
155
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
156
&amp;$aBand</font>
157
158
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Band object</td></tr>
159
160
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
161
$aToY2</font>
162
 
163
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
164
 
165
</td><td>Add object to Y2 axis</td></tr>
166
</table>
167
168
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>A plot may have one or several filled horizontal or vertical "bands" to emphasise certain scale areas.
169
 
170
Each band is an instance of the PlotBand class. For types of plot band see the documentation of class PlotBand
171
 
172
Note: You can alos use the standard method Add() to add bands.&nbsp;<br>
173
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="PlotBand.html#_PLOTBAND_PLOTBAND">PlotBand::PlotBand</a> and <a href="Graph.html#_GRAPH_ADD">Graph::Add</a>
174
 
175
$graph-&gt;AddBand(new&nbsp;PlotBand(HORIZONTAL,BAND_RDIAG,0,&nbsp;"max",&nbsp;"red",&nbsp;2));</font>
176
</span><br>
177
<p>
178
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_ADDLINE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
179
 
180
</b></div></a></span>
181
182
<span style='font-family:arial;font-size:90%;'><i>Add a line object (class PlotLine) to the graph</i></span><p>
183
184
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
185
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
186
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
187
&amp;$aLine</font>
188
189
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Line object to add</td></tr>
190
191
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
192
$aToY2</font>
193
 
194
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
195
 
196
</td><td>Add line to Y2 axis</td></tr>
197
</table>
198
199
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Add a vertical or horizontal line to the graph. The line will extend over the entire length of the plot. The plot object is an instance of the PlotLine class
200
 
201
Note: You can alos use the standard method Add() to add lines.&nbsp;<br>
202
 
203
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
204
//&nbsp;Add&nbsp;mark&nbsp;graph&nbsp;with&nbsp;static&nbsp;lines
<br />$graph-&gt;AddLine(new&nbsp;PlotLine(HORIZONTAL,0,"black",2));
<br />$graph-&gt;AddLine(new&nbsp;PlotLine(VERTICAL,3,"black",2));</font>
205
 
206
<p>
207
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_ADDTEXT"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
208
function&nbsp;AddText(&amp;$aTxt,$aToY2)</font>
209
</b></div></a></span>
210
 
211
<span style='font-family:arial;font-size:90%;'><i>Add text object to the graph</i></span><p>
212
213
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
214
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
215
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
216
&amp;$aTxt</font>
217
218
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Text object to add</td></tr>
219
220
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
221
$aToY2</font>
222
223
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
224
 
225
</td><td>Add text to Y2 axis</td></tr>
226
 
227
228
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Adds an instance of the Text class to the graph, allowing arbitrary text to be placed anywhere in the graph.
229
<p>
230
Note: You can alos use the standard method Add() to add bands.
231
 
232
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Text.html#_TEXT_TEXT">Text::Text</a> and <a href="Graph.html#_GRAPH_ADD">Graph::Add</a>
233
 
234
//&nbsp;You&nbsp;can&nbsp;specify&nbsp;the&nbsp;position&nbsp;as&nbsp;fraction&nbsp;of&nbsp;the
<br />//&nbsp;image&nbsp;width&nbsp;and&nbsp;height
<br />$caption=new&nbsp;Text(?Figure&nbsp;1.&nbsp;Temperature&nbsp;over&nbsp;time?,0.1,0.8);
<br />$caption-&gt;SetFont(FONT1_BOLD);
<br />$graph-&gt;AddText($caption);
<br /></font>
235
</span><br>
236
 
237
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_ADDY"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
238
function&nbsp;AddY($aN,&amp;$aPlot)</font>
239
</b></div></a></span>
240
241
 
242
243
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
244
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
245
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
246
$aN</font>
247
248
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Number of axis to add data to</td></tr>
249
250
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
251
&amp;$aPlot</font>
252
253
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>The plot to be added</td></tr>
254
</table>
255
256
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>This method is used to add a plot in the case the graph has multiple Y-axis. The first argument should be the index of the  Y-axis.&nbsp;<br>
257
258
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
259
 
260
</span><br>
261
 
262
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_ADDY2"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
263
function&nbsp;AddY2(&amp;$aPlot)</font>
264
</b></div></a></span>
265
266
 
267
268
 
269
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
270
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
271
 
272
273
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Plot to add to the Y2 axis</td></tr>
274
 
275
276
 
277
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_ADD">Graph::Add</a> and <a href="Graph.html#_GRAPH_SETY2SCALE">Graph::SetY2Scale</a>
278
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
279
$graph&nbsp;=&nbsp;new&nbsp;Graph(300,200);
<br />$graph-&gt;SetScale('linlin');
<br />$graph-&gt;SetY2Scale('linlog');
<br />$lineplot&nbsp;=&nbsp;new&nbsp;LinePlot($datay);
<br />$graph-&gt;AddY2($lineplot);</font>
280
</span><br>
281
<p>
282
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_CHECKCSIMCACHE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
283
function&nbsp;CheckCSIMCache($aCacheName,$aTimeOut)</font>
284
</b></div></a></span>
285
286
<span style='font-family:arial;font-size:90%;'><i>Check if cached CSIM graph exists</i></span><p>
287
288
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
289
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
290
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
291
$aCacheName</font>
292
293
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Cache file name</td></tr>
294
295
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
296
$aTimeOut</font>
297
298
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
299
60</font>
300
</td><td>Timeout (in minutes)</td></tr>
301
</table>
302
303
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>This method is used to enable caching for graphs that use image maps (CSIM). It should be called as the first method after the creation of the Graph(). If the cached image and image map exists this will be directly sent back to the browser and script execution will stop.
304
<p>
305
This specifically means that no lines of code after this method will be executed in case the image/map is found in the cache.
306
&nbsp;<br>
307
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_STROKECSIM">Graph::StrokeCSIM</a>
308
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
309
$graph&nbsp;=&nbsp;Graph(300,200);
<br />$graph-&gt;CheckCSIMCache('myimage01',10);
<br />
<br />//&nbsp;..&nbsp;Lopt&nbsp;of&nbsp;code&nbsp;to&nbsp;create&nbsp;the&nbsp;image
<br />
<br />$graph-&gt;StrokeCSIM();
<br /></font>
310
</span><br>
311
<p>
312
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_GETHTMLIMAGEMAP"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
313
function&nbsp;GetHTMLImageMap($aMapName)</font>
314
</b></div></a></span>
315
316
<span style='font-family:arial;font-size:90%;'><i>Get a complete <MAP>..</MAP> tag for the final image map</i></span><p>
317
318
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
319
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
320
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
321
$aMapName</font>
322
323
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Image map name</td></tr>
324
</table>
325
326
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>When you are using image maps for a plot then this routine is called in your script to get the resulting image map as a string for the graph. The image map is given the name specified as the first argument to the method.
327
<p>
328
 
329
&nbsp;<br>
330
 
331
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
332
//&nbsp;The&nbsp;image&nbsp;must&nbsp;be&nbsp;stroked&nbsp;to&nbsp;find&nbsp;out&nbsp;the&nbsp;image&nbsp;maps
<br />$graph-&gt;Stroke($myfile);
<br />
<br />//&nbsp;Then&nbsp;read&nbsp;the&nbsp;image&nbsp;map
<br />$imagemap&nbsp;=&nbsp;$graph-&gt;GetHTMLImageMap('MainMap');
<br />
<br />echo&nbsp;$imagemap;
<br />echo&nbsp;"&lt;img&nbsp;src=$myfile&gt;";
<br /></font>
333
</span><br>
334
<p>
335
 
336
function&nbsp;Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline)</font>
337
</b></div></a></span>
338
 
339
<span style='font-family:arial;font-size:90%;'><i>Creates a new graph.</i></span><p>
340
341
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
342
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
343
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
344
$aWidth</font>
345
346
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
347
300</font>
348
</td><td>Width</td></tr>
349
350
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
351
$aHeight</font>
352
 
353
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
354
 
355
</td><td>Height</td></tr>
356
357
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
358
$aCachedName</font>
359
 
360
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
361
 
362
</td><td>Cache file name</td></tr>
363
364
 
365
$aTimeOut</font>
366
367
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
368
0</font>
369
 
370
371
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
372
$aInline</font>
373
374
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
375
true</font>
376
</td><td>True=Stream the image back to the browser</td></tr>
377
</table>
378
379
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Creates a new graph. This is often the first call made to set-up a new graph.
380
<br>
381
If the cache name is specified (via the $aCachedname) argument then this method will first try to locate the named file in the cache directory (as specified by the DEFINE in jpgraph.php) rather then generating the graph on the fly. If the file is not there or if it is older then the specified timeout value ($aTimeOut) the graph will be generated and saved as the specified file.
382
<p>
383
If the cache name is specifed as 'auto' then the cache name will be based on the basename of the script with an extension indicating the image format used, i.e. JPG, GIF or PNG.
384
<p>
385
If the specified file is found in the cache directory then it will be streamed back to the browser directly.
386
<p>
387
If no cache name is specified then the graph will always be generated and the cache bypassed. The same is true if the DEFINE 'USE_CACHE' or 'READ_CACHE' is set to false.
388
 
389
Before any other operation is performed on the graph a call to SetScale() should be made to finish the initialisation of the graph.
390
 
391
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_STROKE">Graph::Stroke</a>
392
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
393
//&nbsp;Example&nbsp;1.&nbsp;use&nbsp;cache&nbsp;and&nbsp;automtic&nbsp;create&nbsp;the&nbsp;cache&nbsp;name
<br />$graph&nbsp;=&nbsp;new&nbsp;Graph(400,200,"auto");&nbsp;&nbsp;&nbsp;&nbsp;
<br />$graph-&gt;img-&gt;SetMargin(60,20,30,50);
<br />$graph-&gt;SetScale("textlin");
<br />$graph-&gt;SetMarginColor("silver");
<br />$graph-&gt;SetShadow();
<br />
<br />//&nbsp;Example&nbsp;2&nbsp;.&nbsp;Don't&nbsp;use&nbsp;the&nbsp;cache
<br />$graph&nbsp;=&nbsp;new&nbsp;Graph(400,200);&nbsp;&nbsp;&nbsp;&nbsp;
<br />$graph-&gt;SetScale("textint");
<br /></font>
394
</span><br>
395
 
396
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SET3DPERSPECTIVE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
397
function&nbsp;Set3DPerspective($aDir,$aHorizon,$aSkewDist,$aQuality,$aFillColor,$aBorder,$aMinSize,$aHorizonPos)</font>
398
 
399
400
<span style='font-family:arial;font-size:90%;'><i>Enable image perspective transformation</i></span><p>
401
402
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
403
 
404
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
405
$aDir</font>
406
407
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
408
1</font>
409
</td><td>Direction for 3D perspective</td></tr>
410
411
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
412
$aHorizon</font>
413
414
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
415
100</font>
416
</td><td>Distance (in pixels) from the bottom of the image to the horizon</td></tr>
417
418
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
419
 
420
421
 
422
120</font>
423
</td><td>Skew distance (in pixels) on the horizon</td></tr>
424
425
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
426
 
427
428
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
429
false</font>
430
 
431
432
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
433
 
434
435
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
436
'#FFFFFF'</font>
437
 
438
439
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
440
 
441
442
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
443
false</font>
444
 
445
446
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
447
 
448
449
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
450
true</font>
451
 
452
453
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
454
 
455
456
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
457
0.5</font>
458
</td><td>Distance from left on the horizon for the point of focus</td></tr>
459
 
460
461
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Enable final image perspective transformation before sending the image back to the browser. This makes a "skewing" tansformation of the image to emulate a 3D depth.
462
463
<p>
464
Allowed argument for $aDir are
465
<ol>
466
<li>'SKEW3D_UP'
467
<li>'SKEW3D_DOWN'
468
<li>'SKEW3D_LEFT'
469
<li>'SKEW3D_RIGHT'
470
</ol>
471
472
<i>$aHorizon</i> Determines how far away the horizon are from the bottom of the picture (in pixels)
473
<p>
474
<i>aSkewDist</i> How far to the right on the horizon is the
475
"skewing point", a large value gives a very strong for-shortening.
476
<p>
477
<i>aQuality</i> Use high quality (takes longer time) TRUE or FALSE
478
<p>
479
<i>aFIllColor</i> Fill background color in the image on places where the original image no longer cover the entire canvas.
480
<p>
481
<i>aBorder</i> Border around or not
482
<p>
483
<i>aMinSize</i> Just make the image as large as it has to be. TRUE or FALSE. If this argument is set to false then the original image size will be preserved.
484
<p>
485
<i>aHorizonPos</i>How far, in fraction, should the point of focus be from the left edge of the image.&nbsp;<br>
486
487
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
488
$graph-&gt;Set3DPerspective(SKEW3D_UP,100,120,true);</font>
489
</span><br>
490
 
491
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SET90ANDMARGIN"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
492
 
493
</b></div></a></span>
494
495
<span style='font-family:arial;font-size:90%;'><i>Rotate the graph 90 degrees and set the margins</i></span><p>
496
497
 
498
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
499
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
500
$lm</font>
501
 
502
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
503
0</font>
504
 
505
506
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
507
$rm</font>
508
 
509
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
510
0</font>
511
 
512
513
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
514
$tm</font>
515
 
516
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
517
0</font>
518
 
519
520
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
521
$bm</font>
522
 
523
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
524
0</font>
525
 
526
</table>
527
528
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Rotates the graph 90 degrees and sets the margin as specified.
529
 
530
Remember that when rotating the graph it might be a good idea to adjust the axis so that the alignment of the labels for x and Y axis. For example by setting them as:
531
532
 
533
$graph->xaxis->SetLabelAlign('right','center','right');
534
<br>
535
$graph->yaxis->SetLabelAlign('center','bottom');
536
 
537
Note: This is slightly different from using SetAngle() and SetMargin() in that this method automatically adjusts the margin so that width becomes height and vice versa due to the rotation.
538
539
 
540
&nbsp;<br>
541
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETANGLE">Graph::SetAngle</a> and <a href="Graph.html#_GRAPH_SETMARGIN">Graph::SetMargin</a>
542
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
543
 
544
</span><br>
545
<p>
546
 
547
function&nbsp;SetAlphaBlending($aFlg)</font>
548
</b></div></a></span>
549
550
<span style='font-family:arial;font-size:90%;'><i>Eanble/disable alpha blending</i></span><p>
551
 
552
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
553
 
554
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
555
$aFlg</font>
556
557
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
558
true</font>
559
</td><td>TRUE=Enable alpha blending</td></tr>
560
</table>
561
562
 
563
<p>
564
"red@0.5" (or  "#FF0000@0.5")
565
<p>
566
can then use this color specification in all places where the color may be specified. If the alpha blending is not active then the alpha parameter will have no effect.
567
<p>
568
Note that the use of alpha blending requires GD 2.01 or higher. By default alpha blending is enabled.
569
&nbsp;<br>
570
571
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
572
$graph-&gt;SetAlphaBlending();</font>
573
</span><br>
574
<p>
575
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETANGLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
576
function&nbsp;SetAngle($aAngle)</font>
577
 
578
579
<span style='font-family:arial;font-size:90%;'><i>Specify graph angle 0-360 degrees.</i></span><p>
580
581
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
582
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
583
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
584
$aAngle</font>
585
 
586
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Rotation angle for graph</td></tr>
587
 
588
589
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>The graph can be rotated an arbitrary number of degrees. This will allow you to easily create, for example, horizontal bar graphs by rotating a normal bar graph 90 degrees.
590
<p>
591
See horizbarex1.php for a real life example.
592
 
593
Note: If you want a 90 degrees rotated graph consider using Graph::Set90AndMargin() which greatly simplifies this with just one call
594
&nbsp;<br>
595
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SET90ANDMARGIN">Graph::Set90AndMargin</a>
596
 
597
$graph&nbsp;=&nbsp;new&nbsp;Graph(300,200);
<br />$graph-&gt;SetScale('textlin');
<br />$graph-&gt;SetAngle(90);</font>
598
</span><br>
599
 
600
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETAXISLABELBACKGROUND"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
601
function&nbsp;SetAxisLabelBackground($aType,$aXFColor,$aXColor,$aYFColor,$aYColor)</font>
602
</b></div></a></span>
603
 
604
<span style='font-family:arial;font-size:90%;'><i>// Finally stream the generated picture</i></span><p>
605
606
 
607
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
608
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
609
$aType</font>
610
 
611
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>No description available</td></tr>
612
613
 
614
$aXFColor</font>
615
616
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
617
'lightgray'</font>
618
 
619
620
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
621
$aXColor</font>
622
 
623
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
624
'black'</font>
625
</td><td>No description available</td></tr>
626
627
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
628
$aYFColor</font>
629
 
630
 
631
'lightgray'</font>
632
</td><td>No description available</td></tr>
633
634
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
635
$aYColor</font>
636
637
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
638
'black'</font>
639
</td><td>No description available</td></tr>
640
</table>
641
642
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>No description available.<p>
643
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETAXISSTYLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
644
function&nbsp;SetAxisStyle($aStyle)</font>
645
</b></div></a></span>
646
647
<span style='font-family:arial;font-size:90%;'><i>Specify axis style (boxed or single)</i></span><p>
648
649
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
650
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
651
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
652
$aStyle</font>
653
654
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Style of axis</td></tr>
655
</table>
656
657
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>The most common type of axis is two axis which crosses at a specified point. However for scientific plot it is often common to want to mirror the axis (and the scale) around the plot area.
658
This method controls which type to use
659
660
<ul>
661
<li> AXSTYLE_SIMPLE, a simple two axis plots (default)
662
 
663
<li> AXSTYLE_BOXOUT, axis around the plot area with the tick marks directed outside of the plot area
664
 
665
666
See funcex1.php, funcex2.php and funcex3.php for real life examples.&nbsp;<br>
667
668
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
669
 
670
</span><br>
671
<p>
672
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETBACKGROUNDCFLAG"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
673
function&nbsp;SetBackgroundCFlag($aName,$aBgType,$aMix)</font>
674
 
675
676
<span style='font-family:arial;font-size:90%;'><i>Set a country flag in the background</i></span><p>
677
678
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
679
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
680
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
681
$aName</font>
682
683
 
684
685
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
686
$aBgType</font>
687
688
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
689
BGIMG_FILLPLOT</font>
690
</td><td>Background fill type</td></tr>
691
 
692
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
693
 
694
695
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
696
100</font>
697
</td><td>Mix percentage</td></tr>
698
 
699
700
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>[Synonym for SetBackgroundCountryFlag() )
701
 
702
<ol>
703
<li> Numeric index, (0-238)
704
<li> Full or partial name, e.g. "norway"
705
<li> The unique string index for the country
706
</ol>
707
708
For a list of all available flags please run the file "listallflags.php" in the Example directory.
709
<p>
710
The final arcgument "aMix" is a value between 0-100 and specifies the blend factor for the flag.&nbsp;<br>
711
<p>
712
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETBACKGROUNDCOUNTRYFLAG"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
713
function&nbsp;SetBackgroundCountryFlag($aName,$aBgType,$aMix)</font>
714
</b></div></a></span>
715
716
<span style='font-family:arial;font-size:90%;'><i>Set a country flag in the graph background</i></span><p>
717
718
 
719
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
720
 
721
$aName</font>
722
723
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Full or partial country name</td></tr>
724
725
 
726
$aBgType</font>
727
 
728
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
729
BGIMG_FILLPLOT</font>
730
 
731
732
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
733
$aMix</font>
734
 
735
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
736
100</font>
737
 
738
</table>
739
740
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Set a country flag in the background. All supported countries can be specified by either
741
 
742
<li> Numeric index, (0-238)
743
<li> Full or partial name, e.g. "norway"
744
 
745
</ol>
746
747
For a list of all available flags please run the file "listallflags.php" in the Example directory.
748
 
749
The final arcgument "aMix" is a value between 0-100 and specifies the blend factor for the flag.
750
&nbsp;<br>
751
 
752
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETBACKGROUNDGRADIENT"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
753
function&nbsp;SetBackgroundGradient($aFrom,$aTo,$aGradType,$aStyle)</font>
754
</b></div></a></span>
755
756
 
757
758
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
759
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
760
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
761
 
762
763
 
764
'navy'</font>
765
</td><td>Color 1</td></tr>
766
767
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
768
 
769
770
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
771
 
772
</td><td>Color 2</td></tr>
773
774
 
775
$aGradType</font>
776
777
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
778
2</font>
779
</td><td>Gradient type</td></tr>
780
 
781
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
782
 
783
784
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
785
BGRAD_FRAME</font>
786
</td><td>Gardient layout style</td></tr>
787
</table>
788
789
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>This method allows you to specify a color gradient as the background of the graph. The color gradient can either fill the entire graph, just the plopt area or just the margin. This is specified by the $aStyle argument by specifyin one of the following values:
790
<ul>
791
 
792
<li>BGRAD_PLOT, Just fill the plot area
793
 
794
</ul>
795
796
The gradient type can be one of
797
<ul>
798
 
799
<li>GRAD_HOR, Horizontal gradient
800
 
801
<li>GRAD_MIDVER, From the center and out, vertical
802
<li>GRAD_WIDE_MIDVER, From the center and out, vertical. Wide mid section.
803
 
804
<li>GRAD_CENTER, From the center and beaming out
805
<li>GRAD_LEFT_REFLECTION, Simulates a reflection on the left side
806
<li>GRAD_RIGHT_REFLECTION, Simulates a reflection on the right side
807
 
808
809
<b>Note:</b> In order for the gradient to be visible the Frame must be enabled, i.e. graph->ShowFrame(false) will hide the gradient. If you like to hide the frame around the entire graph set the color to the margin color or set the weight of the frame line to 0.
810
 
811
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETBACKGROUNDIMAGE">Graph::SetBackgroundImage</a> and <a href="Graph.html#_GRAPH_SETFRAME">Graph::SetFrame</a>
812
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
813
$graph-&gt;SetBackgroundGradient('blue','navy:0.5',GRAD_HOR,BGRAD_MARGIN);</font>
814
</span><br>
815
 
816
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETBACKGROUNDIMAGE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
817
function&nbsp;SetBackgroundImage($aFileName,$aBgType,$aImgFormat)</font>
818
</b></div></a></span>
819
820
<span style='font-family:arial;font-size:90%;'><i>Specify a background image fro the plot</i></span><p>
821
822
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
823
 
824
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
825
$aFileName</font>
826
827
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Filename for background image</td></tr>
828
829
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
830
$aBgType</font>
831
 
832
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
833
 
834
</td><td>Style of background image</td></tr>
835
836
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
837
$aImgFormat</font>
838
 
839
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
840
 
841
</td><td>Image format ("jpeg", "gif", "png")</td></tr>
842
</table>
843
 
844
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>A graph may have a background image. The image is loaded from a specified file and may be of type GIF, JPG or PNG. The image type may also be specified as "auto", in this case the image format is determined by the file ending.
845
<p>
846
The positioning and sizing of the background image can be controlled by the $aBgType parameter. Possible values are
847
 
848
<li>BGIMG_FILLPLOT, Adjust the size of the image to just fit the plotarea
849
<li>BGIMG_FILLFRAME, ADjust the size of the image to just fit the entire graph area
850
 
851
<li>BGIMG_CENTER, Just copy the image but center it.
852
</ul>
853
854
If you want ot use a background image on a canvas graph you must be carefull. Since canvas graph use no buffering, i.e everythng is written directly in the order you specify the commands. For canvas graph the background image get's stroked when you call the Initframe()  method.
855
 
856
857
&nbsp;<br>
858
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETBACKGROUNDGRADIENT">Graph::SetBackgroundGradient</a>
859
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
860
//&nbsp;
<br />$graph-&gt;SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
<br />
<br />//&nbsp;If&nbsp;you&nbsp;use&nbsp;a&nbsp;canvas&nbsp;graph,&nbsp;and&nbsp;only&nbsp;canvas&nbsp;graphs,
<br />//&nbsp;you&nbsp;must&nbsp;manually&nbsp;call&nbsp;the&nbsp;InitFrame()&nbsp;method.
<br />$graph-&gt;InitFrame();</font>
861
</span><br>
862
 
863
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETBACKGROUNDIMAGEMIX"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
864
function&nbsp;SetBackgroundImageMix($aMix)</font>
865
</b></div></a></span>
866
867
<span style='font-family:arial;font-size:90%;'><i>Specifes what how much the background image should be blendid in with the background</i></span><p>
868
869
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
870
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
871
 
872
$aMix</font>
873
 
874
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Mix value (0-100)</td></tr>
875
</table>
876
877
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specifes what how much the background image should be blendid in with the background.&nbsp;<br>
878
 
879
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETBOX"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
880
function&nbsp;SetBox($aDrawPlotFrame,$aPlotFrameColor,$aPlotFrameWeight)</font>
881
</b></div></a></span>
882
 
883
<span style='font-family:arial;font-size:90%;'><i>Set a frame around the plot area</i></span><p>
884
885
 
886
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
887
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
888
$aDrawPlotFrame</font>
889
 
890
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
891
true</font>
892
 
893
894
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
895
$aPlotFrameColor</font>
896
 
897
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
898
array(0,0,0)</font>
899
 
900
901
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
902
$aPlotFrameWeight</font>
903
904
 
905
1</font>
906
</td><td>Width fo frame line</td></tr>
907
</table>
908
909
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>This is used to specify whether the plot-area should have a rectangle around it and the specifics of that rectangle.&nbsp;<br>
910
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETFRAME">Graph::SetFrame</a>
911
 
912
$graph&nbsp;=&nbsp;new&nbsp;Graph(300,200);
<br />$graph-&gt;SetScale('linlin');
<br />$graph-&gt;Box();
<br /></font>
913
</span><br>
914
<p>
915
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETCLIPPING"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
916
function&nbsp;SetClipping($aFlg)</font>
917
</b></div></a></span>
918
919
<span style='font-family:arial;font-size:90%;'><i>Enable clipping of graph outside the plotarea</i></span><p>
920
921
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
922
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
923
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
924
 
925
926
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
927
true</font>
928
</td><td>Enable/disbale clipping</td></tr>
929
</table>
930
931
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Enable or disable clipping outside the plot area. If clipping is enabled then only the part of the graph exactly inside the plot area will be visible.
932
<p>
933
Clipping may come in handy when you for example set a manual scale and have data points outside the specified range.
934
<p>
935
 
936
<p>
937
 
938
<p>
939
Note 2: The clipping is implemented with a O(1) algorithm in terns of data size.
940
&nbsp;<br>
941
942
 
943
$graph-&gt;SetClipping();</font>
944
 
945
<p>
946
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETCOLOR"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
947
 
948
</b></div></a></span>
949
950
<span style='font-family:arial;font-size:90%;'><i>Specify color for the plotarea (not the margins)</i></span><p>
951
 
952
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
953
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
954
 
955
$aColor</font>
956
957
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Color</td></tr>
958
</table>
959
 
960
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify color for the plotarea (not the margins)&nbsp;<br>
961
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETFRAME">Graph::SetFrame</a> and <a href="Graph.html#_GRAPH_SETMARGINCOLOR">Graph::SetMarginColor</a>
962
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
963
$graph-&gt;SetColor(?wheat?);</font>
964
</span><br>
965
<p>
966
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETCSIMIMGALT"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
967
function&nbsp;SetCSIMImgAlt($aAlt)</font>
968
</b></div></a></span>
969
 
970
<span style='font-family:arial;font-size:90%;'><i>Set the Alt text used for the IMG tag generated for CSIM</i></span><p>
971
972
 
973
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
974
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
975
$aAlt</font>
976
977
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Alt text</td></tr>
978
</table>
979
980
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Set the ALt text used for the IMG tag generated for CSIM. Whne calling StrokeCSIM() a HTML page will be returned witha recusrive call to teh same script in an IMG tag. This method allows you to specify the Alt text to be used in the returned HTML page.&nbsp;<br>
981
<br>
982
<div style="font-weight:bold;font-family:arial;font-size:85%;">Returns</div>void<br>
983
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_STROKECSIM">Graph::StrokeCSIM</a>
984
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
985
$graph-&gt;SetCSIMImgAlt('Yearly&nbsp;values');
<br />$graph-&gt;StrokeCSIM();
<br /></font>
986
</span><br>
987
 
988
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETFRAME"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
989
 
990
</b></div></a></span>
991
992
<span style='font-family:arial;font-size:90%;'><i>Set a frame around the entire image</i></span><p>
993
994
 
995
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
996
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
997
 
998
999
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1000
true</font>
1001
</td><td>True=Draw a frame around the entire image</td></tr>
1002
1003
 
1004
$aImgFrameColor</font>
1005
 
1006
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1007
array(0,0,0)</font>
1008
</td><td>Frame color</td></tr>
1009
1010
 
1011
$aImgFrameWeight</font>
1012
1013
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1014
 
1015
</td><td>Width of frame</td></tr>
1016
</table>
1017
 
1018
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Sets a frame (rectangle) of the chosen color around the edges of the image.
1019
1020
Note: For implementation reasons the frame must be enabled in order to for a specified gradient background to show up.
1021
 
1022
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETMARGINCOLOR">Graph::SetMarginColor</a>
1023
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1024
 
1025
</span><br>
1026
<p>
1027
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETFRAMEBEVEL"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1028
function&nbsp;SetFrameBevel($aDepth,$aBorder,$aBorderColor,$aColor1,$aColor2,$aFlg)</font>
1029
 
1030
1031
<span style='font-family:arial;font-size:90%;'><i>Specify a abevel frame around the entire graph</i></span><p>
1032
1033
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1034
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1035
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1036
$aDepth</font>
1037
1038
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1039
3</font>
1040
</td><td>Depth (Height) in pixels for bevel</td></tr>
1041
1042
 
1043
$aBorder</font>
1044
 
1045
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1046
false</font>
1047
</td><td>True=Add 1 pixel border around</td></tr>
1048
1049
 
1050
$aBorderColor</font>
1051
1052
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1053
'black'</font>
1054
 
1055
1056
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1057
$aColor1</font>
1058
1059
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1060
'white@0.4'</font>
1061
</td><td>Right and bottom shadow</td></tr>
1062
1063
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1064
$aColor2</font>
1065
 
1066
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1067
'darkgray@0.4'</font>
1068
</td><td>Left and top shadow</td></tr>
1069
1070
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1071
$aFlg</font>
1072
1073
 
1074
true</font>
1075
 
1076
</table>
1077
1078
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify a a bevel frame around the entire graph. A Bevel frame will give the entire graph a "3D" uprised feel.&nbsp;<br>
1079
1080
 
1081
$graph-&gt;SetFrameBevel(2,true,'black');</font>
1082
</span><br>
1083
 
1084
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETGRIDDEPTH"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1085
function&nbsp;SetGridDepth($aDepth)</font>
1086
</b></div></a></span>
1087
1088
<span style='font-family:arial;font-size:90%;'><i>Should the grid be in front or back of the plot?</i></span><p>
1089
1090
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1091
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1092
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1093
 
1094
1095
 
1096
</table>
1097
1098
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify if the grid in the plot should be drawn under or on top of the actual plots.
1099
<p>
1100
 
1101
<ul>
1102
<li>DEPTH_BACK, Under plots
1103
 
1104
</ul>
1105
<p>
1106
The default is to draw the grid lines under the plots.&nbsp;<br>
1107
1108
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1109
$graph-&gt;SetGridDepth(DEPTH_FRONT);
<br /></font>
1110
</span><br>
1111
<p>
1112
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETICONDEPTH"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1113
function&nbsp;SetIconDepth($aDepth)</font>
1114
</b></div></a></span>
1115
1116
<span style='font-family:arial;font-size:90%;'><i>Determine if Icons should be under or over the plot</i></span><p>
1117
 
1118
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1119
 
1120
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1121
$aDepth</font>
1122
1123
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Depth of icons (see description)</td></tr>
1124
 
1125
1126
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Determine if Icons should be under or over the plot. The argument is one of
1127
<ul>
1128
 
1129
<li> DEPTH_FRONT
1130
</ul>
1131
 
1132
By default the icons are drawn under the plots&nbsp;<br>
1133
1134
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1135
 
1136
</span><br>
1137
<p>
1138
 
1139
function&nbsp;SetImgFormat($aFormat,$aQuality)</font>
1140
</b></div></a></span>
1141
1142
<span style='font-family:arial;font-size:90%;'><i>Set Image format and optional quality</i></span><p>
1143
 
1144
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1145
 
1146
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1147
$aFormat</font>
1148
1149
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Format (see description)</td></tr>
1150
1151
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1152
$aQuality</font>
1153
1154
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1155
75</font>
1156
 
1157
</table>
1158
 
1159
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify what image format the generated image should use. By default the library will try to create PNG images and if the PNG libraries are not available then it will try to use foirst JPEG and finally GIF encoding.
1160
<p>
1161
The image format is specified as a string that can be one of
1162
<ul>
1163
 
1164
<li> "JPEG", JPEG format
1165
<li> "GIF", GIF Format
1166
</ul>
1167
 
1168
The PNG format gives in general best compression for ordinary data plots and is also a looseless format.
1169
<p>
1170
 
1171
<p>
1172
The quality parameter is a value between (0,100) inclusively. = gives best compression but worst quality and 100 give the best quality. Suitable ranges is 60-90.
1173
&nbsp;<br>
1174
 
1175
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1176
//&nbsp;Set&nbsp;JPEG&nbsp;format&nbsp;with&nbsp;60%&nbsp;quality
<br />$graph-&gt;SetImgFormat('jpeg',60);</font>
1177
 
1178
<p>
1179
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETMARGIN"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1180
function&nbsp;SetMargin($lm,$rm,$tm,$bm)</font>
1181
 
1182
1183
<span style='font-family:arial;font-size:90%;'><i>Specify side margins for graph</i></span><p>
1184
 
1185
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1186
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1187
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1188
 
1189
1190
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Left margin (in pixels)</td></tr>
1191
 
1192
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1193
$rm</font>
1194
1195
 
1196
1197
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1198
 
1199
1200
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Top margin (in pixels)</td></tr>
1201
1202
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1203
 
1204
1205
 
1206
</table>
1207
1208
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify the margin around the actual plot area. This is actually just a shortcut for the Image::SetMargin()
1209
<p>
1210
Note: If you want to set the margin for a 90 degrees rotated graph please consider using Graph::Set90AndMargin() instead since this will automatically adjust for the rotated image and the swapped meaning of width and height.
1211
&nbsp;<br>
1212
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_SETMARGIN">Image::SetMargin</a>
1213
 
1214
$graph-&gt;SetMargin(40,20,60,20);</font>
1215
 
1216
<p>
1217
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETMARGINCOLOR"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1218
function&nbsp;SetMarginColor($aColor)</font>
1219
</b></div></a></span>
1220
 
1221
<span style='font-family:arial;font-size:90%;'><i>Specify color for the margins (all areas outside the plotarea)</i></span><p>
1222
1223
 
1224
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1225
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1226
$aColor</font>
1227
1228
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Color</td></tr>
1229
</table>
1230
1231
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specifies the color of the area between the plot area and the edge of the image.&nbsp;<br>
1232
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETCOLOR">Graph::SetColor</a> and <a href="Graph.html#_GRAPH_SETFRAME">Graph::SetFrame</a>
1233
 
1234
$graph-&gt;SetMarginColor('silver');</font>
1235
</span><br>
1236
<p>
1237
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETSCALE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1238
function&nbsp;SetScale($aAxisType,$aYMin,$aYMax,$aXMin,$aXMax)</font>
1239
</b></div></a></span>
1240
1241
<span style='font-family:arial;font-size:90%;'><i>Specify scale to use for X and Y axis</i></span><p>
1242
 
1243
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1244
 
1245
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1246
$aAxisType</font>
1247
1248
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Type of axis</td></tr>
1249
 
1250
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1251
$aYMin</font>
1252
 
1253
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1254
1</font>
1255
</td><td>Y-min</td></tr>
1256
1257
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1258
 
1259
1260
 
1261
1</font>
1262
</td><td>Y-max</td></tr>
1263
1264
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1265
$aXMin</font>
1266
1267
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1268
1</font>
1269
 
1270
1271
 
1272
$aXMax</font>
1273
1274
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1275
1</font>
1276
 
1277
</table>
1278
 
1279
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specifies what kind of scales should be used in the graph. The following combinations are allowed
1280
1281
 
1282
<li> Linear scale. Both X and Y axis
1283
<li>Logarithmic scale. Both X and Y axis
1284
<li>Text scale. Only on X axis
1285
<li>Integer scale. X and Y axis
1286
 
1287
1288
Any combination of these may be used. Linear and logarithmic scales are pretty straightforward. The text scale might deserve some explanation. The easiest way to think of the text scale is as a linear scale consisting of only natural numbers, i.e. 0,1,2,3,4,? . This scale is used when you just have a number of Y-values you want to plot in a consecutive order and don?t care about the X-values. It is also used when you need to have text labesl you specify (via $graph->xaxis->SetTickLabels($labels) ).
1289
<p>
1290
To specify which combination of X and Y scales you want to use the $axtype parameter is specified. In this parameter you specify, by a text string, the type of scale you want to use for both X and Y scale.
1291
<p>
1292
Possible values for each axis are:<br>
1293
X: 'lin', 'text', 'log', 'int'<br>
1294
Y: 'lin', 'log', 'int'<br>
1295
 
1296
Example of possible combination:<br>
1297
<ul>
1298
<li>SetScale('textint');
1299
<li>SetScale('loglog');
1300
<li>SetScale('linlog');
1301
</ul>
1302
 
1303
<p>
1304
Note: If you want to use a logarithmic scale you must make sure that the ?jpgraph_log.php?  is included.
1305
<p>
1306
<b>Note1:</b>
1307
Note that if you manually specify the scale you can also specify the tick distance with a call to Ticks::Set(). For example $graph->yaxis->scale->ticks->Set(10,5) If yiou don't ste it manually a suitable tick distance will be automatically choosen.
1308
1309
<b>Note2:</b>
1310
If you want to keep the autoscaling for Y-axis but specify the X-axis then just call the method with both min and max set to 0 (e.g. SetScale('linlin',0,0,0,50); )
1311
 
1312
&nbsp;<br>
1313
 
1314
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1315
//----------------------
<br />//&nbsp;EXAMPLE1:&nbsp;Using&nbsp;autoscaling
<br />$graph-&gt;SetScale('textlin');
<br />
<br />//----------------------
<br />//&nbsp;EXAMPLE2:&nbsp;Using&nbsp;manual&nbsp;scale&nbsp;for&nbsp;Y-scale&nbsp;and&nbsp;only&nbsp;major&nbsp;ticks
<br />$graph-&gt;SetScale('linlin',5,75);
<br />$graph-&gt;yaxis-&gt;scale-&gt;ticks-&gt;Set(10);&nbsp;//&nbsp;Set&nbsp;major&nbsp;and&nbsp;minor&nbsp;tick&nbsp;to&nbsp;10
<br />
<br />//----------------------
<br />//&nbsp;EXAMPLE3:&nbsp;Using&nbsp;manual&nbsp;scale&nbsp;for&nbsp;Y-scale&nbsp;
<br />$graph-&gt;SetScale('linlin',5,200);
<br />//&nbsp;Set&nbsp;major&nbsp;tick&nbsp;dist&nbsp;to&nbsp;40&nbsp;and&nbsp;minor&nbsp;to&nbsp;20&nbsp;
<br />$graph-&gt;yaxis-&gt;scale-&gt;ticks-&gt;Set(40,20);&nbsp;
<br />
<br />//----------------------
<br />//&nbsp;EXAMPLE4:&nbsp;Using&nbsp;manual&nbsp;scale&nbsp;for&nbsp;both&nbsp;X&nbsp;and&nbsp;Y-scale&nbsp;
<br />$graph-&gt;SetScale('linlin',5,200,0,100);
<br />//&nbsp;Set&nbsp;major&nbsp;tick&nbsp;dist&nbsp;to&nbsp;40&nbsp;and&nbsp;minor&nbsp;to&nbsp;20&nbsp;
<br />$graph-&gt;yaxis-&gt;scale-&gt;ticks-&gt;Set(40,20);
<br />//&nbsp;Set&nbsp;major&nbsp;and&nbsp;minor&nbsp;tick&nbsp;dist&nbsp;to&nbsp;20&nbsp;
<br />$graph-&gt;xaxis-&gt;scale-&gt;ticks-&gt;Set(20);&nbsp;
<br />
<br />//&nbsp;Keeping&nbsp;the&nbsp;Autoscaling&nbsp;for&nbsp;Y-axis&nbsp;but&nbsp;fixing&nbsp;the&nbsp;X
<br />//&nbsp;scale&nbsp;to&nbsp;an&nbsp;integer&nbsp;scale&nbsp;between&nbsp;[0,50]
<br />$graph-&gt;SetScale('intlin',0,0,0,50);
<br /></font>
1316
</span><br>
1317
<p>
1318
 
1319
function&nbsp;SetShadow($aShowShadow,$aShadowWidth,$aShadowColor)</font>
1320
 
1321
1322
<span style='font-family:arial;font-size:90%;'><i>Add a drop shadow to the image</i></span><p>
1323
 
1324
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1325
 
1326
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1327
$aShowShadow</font>
1328
 
1329
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1330
 
1331
</td><td>True=add a drop shadow</td></tr>
1332
1333
 
1334
$aShadowWidth</font>
1335
1336
 
1337
5</font>
1338
</td><td>Width (in pixels of shadow)</td></tr>
1339
1340
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1341
$aShadowColor</font>
1342
1343
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1344
array(102,102,102)</font>
1345
</td><td>Shadow color</td></tr>
1346
</table>
1347
1348
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Sets a frame with a drop down shadow around the entire image&nbsp;<br>
1349
 
1350
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1351
 
1352
</span><br>
1353
<p>
1354
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETTEXTSCALEABSCENTEROFF"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1355
function&nbsp;SetTextScaleAbsCenterOff($aOff)</font>
1356
 
1357
1358
<span style='font-family:arial;font-size:90%;'><i>// Text width of bar to be centered in absolute pixels</i></span><p>
1359
 
1360
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1361
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1362
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1363
$aOff</font>
1364
1365
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>No description available</td></tr>
1366
</table>
1367
1368
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>No description available.<p>
1369
 
1370
function&nbsp;SetTickDensity($aYDensity,$aXDensity)</font>
1371
 
1372
1373
<span style='font-family:arial;font-size:90%;'><i>Specify how dense the ticks should be drawn</i></span><p>
1374
1375
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1376
 
1377
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1378
 
1379
1380
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1381
 
1382
</td><td>Y-density</td></tr>
1383
1384
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1385
 
1386
1387
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1388
 
1389
</td><td>X-density</td></tr>
1390
</table>
1391
1392
 
1393
<p>
1394
The following DEFINES may be used to hint to the auto-scaling how many ticks should be allocated
1395
 
1396
<ul>
1397
<li>TICKD_DENSE, Small distance between ticks
1398
<li>TICKD_NORMAL, Default value
1399
 
1400
<li>TICKD_VERYSPARSE, Very few ticks
1401
</ul>&nbsp;<br>
1402
 
1403
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1404
$graph-&gt;SetTickDensity(TICKD_DENSE);&nbsp;//&nbsp;Many&nbsp;Y-ticks</font>
1405
</span><br>
1406
<p>
1407
 
1408
function&nbsp;SetTitleBackground($aBackColor,$aStyle,$aFrameStyle,$aFrameColor,$aFrameWeight,$aBevelHeight,$aEnable)</font>
1409
 
1410
1411
<span style='font-family:arial;font-size:90%;'><i>Specify background style for graph titles</i></span><p>
1412
1413
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1414
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1415
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1416
 
1417
1418
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1419
'gray'</font>
1420
</td><td>Background color</td></tr>
1421
1422
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1423
$aStyle</font>
1424
1425
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1426
TITLEBKG_STYLE1</font>
1427
</td><td>Background size style, see description</td></tr>
1428
1429
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1430
$aFrameStyle</font>
1431
1432
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1433
TITLEBKG_FRAME_NONE</font>
1434
</td><td>Frame style, see description</td></tr>
1435
1436
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1437
 
1438
1439
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1440
 
1441
</td><td>Frame color</td></tr>
1442
1443
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1444
$aFrameWeight</font>
1445
1446
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1447
1</font>
1448
</td><td>Frame thickness (weight)</td></tr>
1449
1450
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1451
$aBevelHeight</font>
1452
1453
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1454
3</font>
1455
</td><td>Bevel height  used for frame style bevel</td></tr>
1456
1457
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1458
$aEnable</font>
1459
1460
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1461
true</font>
1462
</td><td>Enable/disable background</td></tr>
1463
</table>
1464
1465
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify background style for graph titles, i.e. the background style for Graph::title, Graph::subtitle, Graph::subsubtitle. The actual background style is specified with the two arguments $aStyle and $aFrameStyle.
1466
<p>
1467
The first argument $aStyle determines the size the background should cover. The two possibilities are
1468
<ul>
1469
<li>TITLEBKG_STYLE1,  FIll the background inside the graph frame
1470
<li>TITLEBKG_STYLE2, Also covers the graph frame
1471
<li>TITLEBKG_STYLE3, Used together with the Bevel frame. WIll put the title beackground under the graph bevel.
1472
</ul>
1473
1474
The second style parameter specifies what type of frame should be drawn. The weight of the frame is adjustable by specifying the $aFrameweight argument. The possible options for frame styles are:
1475
<ul>
1476
 
1477
<li> TITLEBKG_FRAME_FULL, Full frame around the background
1478
 
1479
<li> TITLEBKG_FRAME_BEVEL, Draw a Bevel 3D effect (looks like a raised square button). The height of the bevel can be adjusted with the $aBevelHeight argument.
1480
</ul>
1481
1482
You can further adjust the style of the background fill by the SetTitleBackgroundFillStyle() method.
1483
 
1484
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_BEVEL">Image::Bevel</a> and <a href="Graph.html#_GRAPH_SETTITLEBACKGROUNDFILLSTYLE">Graph::SetTitleBackgroundFillStyle</a>
1485
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1486
$graph-&gt;SetTitleBackground('wheat2',TITLEBKG_STYLE1,TITLEBKG_FRAME_BOTTOM);</font>
1487
 
1488
<p>
1489
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETTITLEBACKGROUNDFILLSTYLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1490
 
1491
</b></div></a></span>
1492
1493
<span style='font-family:arial;font-size:90%;'><i>Adjust the title background fill style</i></span><p>
1494
 
1495
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1496
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1497
 
1498
$aStyle</font>
1499
1500
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Fill style (see description)</td></tr>
1501
1502
 
1503
$aColor1</font>
1504
1505
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1506
'black'</font>
1507
</td><td>Color 1</td></tr>
1508
1509
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1510
$aColor2</font>
1511
1512
 
1513
'white'</font>
1514
 
1515
</table>
1516
1517
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>The background for the graph titles as set by SetTitleBackground() can be further adjusted with this method. The style can be sepcified as one of
1518
<ul>
1519
 
1520
<li> TITLEBKG_FILLSTYLE_VSTRIPED, Alternating vertical lines of color 1 and color 2
1521
<li> TITLEBKG_FILLSTYLE_SOLID, A solid fill color (default)
1522
 
1523
&nbsp;<br>
1524
1525
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1526
$graph-&gt;SetTitleBackgroundFillStyle(TITLEBKG_FILLSTYLE_HSTRIPED,'darkgreen','black');</font>
1527
 
1528
<p>
1529
 
1530
function&nbsp;SetY2OrderBack($aBack)</font>
1531
</b></div></a></span>
1532
1533
<span style='font-family:arial;font-size:90%;'><i>Specify that plots on the Y2 axis should  be under Y axis plots</i></span><p>
1534
 
1535
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1536
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1537
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1538
 
1539
1540
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1541
 
1542
</td><td>TRUE=under Y axis, FALSE=above</td></tr>
1543
</table>
1544
1545
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Set the depth for Y2 plots as compare to plots added to the Y axis&nbsp;<br>
1546
 
1547
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1548
$graph-&gt;SetY2OrderBack();</font>
1549
</span><br>
1550
 
1551
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETY2SCALE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1552
function&nbsp;SetY2Scale($aAxisType,$aY2Min,$aY2Max)</font>
1553
</b></div></a></span>
1554
1555
<span style='font-family:arial;font-size:90%;'><i>Specify secondary Y scale</i></span><p>
1556
1557
 
1558
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1559
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1560
$aAxisType</font>
1561
1562
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1563
"lin"</font>
1564
</td><td>Type of scale</td></tr>
1565
 
1566
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1567
 
1568
1569
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1570
1</font>
1571
</td><td>Y2Min value</td></tr>
1572
 
1573
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1574
$aY2Max</font>
1575
1576
 
1577
1</font>
1578
</td><td>Y2Max value</td></tr>
1579
 
1580
1581
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>The graph allows two different Y-scales to be used and you can choose which one you want to use for a specific plot by the way you are adding the plot to the graph, either by Add() or by AddY2() method.
1582
<p>
1583
 
1584
<p>
1585
Allowed values for the $axtype are
1586
 
1587
<li>?lin?, Linear scale
1588
<li>?log?, Logarithmic scale
1589
<li>?int?, Integer scale
1590
 
1591
1592
<b>Note:</b> If you want to use a logarithmic scale you must make sure that the ?jpgraph_log.php?  is included.
1593
 
1594
 &nbsp; <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Graph.html#_GRAPH_SETSCALE">Graph::SetScale</a> and <a href="Graph.html#_GRAPH_ADDY2">Graph::AddY2</a>
1595
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1596
//&nbsp;Left&nbsp;Y&nbsp;scale&nbsp;linear&nbsp;and&nbsp;right&nbsp;Y-scale&nbsp;logarithmic
<br />$graph&nbsp;=&nbsp;new&nbsp;Graph(300,200);
<br />$graph-&gt;SetScale(?textlin?);
<br />$graph-&gt;SetY2Scale(?log?);</font>
1597
 
1598
<p>
1599
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETYDELTADIST"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1600
 
1601
</b></div></a></span>
1602
1603
<span style='font-family:arial;font-size:90%;'><i>Set the delta position (in pixels) between the multiple Y-axis</i></span><p>
1604
 
1605
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1606
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1607
 
1608
$aDist</font>
1609
1610
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Distance in pixels</td></tr>
1611
 
1612
1613
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Set the delta position (in pixels) between the multiple Y-axis&nbsp;<br>
1614
 
1615
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_SETYSCALE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1616
function&nbsp;SetYScale($aN,$aAxisType,$aYMin,$aYMax)</font>
1617
</b></div></a></span>
1618
1619
 
1620
1621
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1622
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1623
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1624
$aN</font>
1625
1626
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Index of axis</td></tr>
1627
1628
 
1629
$aAxisType</font>
1630
1631
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1632
"lin"</font>
1633
</td><td>Scale type of axis</td></tr>
1634
1635
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1636
 
1637
1638
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1639
1</font>
1640
</td><td>Optional min scale value</td></tr>
1641
1642
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1643
$aYMax</font>
1644
1645
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1646
1</font>
1647
 
1648
</table>
1649
 
1650
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify scale for additional Y-axis&nbsp;<br>
1651
1652
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1653
<font color="#0000BB">php
<br /></font><font color="#007700">include&nbsp;(</font><font color="#DD0000">"../jpgraph.php"</font><font color="#007700">);
<br />include&nbsp;(</font><font color="#DD0000">"../jpgraph_line.php"</font><font color="#007700">);
<br />
<br /></font><font color="#0000BB">$datay&nbsp;</font><font color="#007700">=&nbsp;array(</font><font color="#0000BB">5</font><font color="#007700">,</font><font color="#0000BB">3</font><font color="#007700">,</font><font color="#0000BB">7</font><font color="#007700">,</font><font color="#0000BB">2</font><font color="#007700">);
<br /></font><font color="#0000BB">$datay2&nbsp;</font><font color="#007700">=&nbsp;array(</font><font color="#0000BB">88</font><font color="#007700">,</font><font color="#0000BB">10</font><font color="#007700">,</font><font color="#0000BB">55</font><font color="#007700">,</font><font color="#0000BB">42</font><font color="#007700">);
<br /></font><font color="#0000BB">$datay3&nbsp;</font><font color="#007700">=&nbsp;array(</font><font color="#0000BB">255</font><font color="#007700">,</font><font color="#0000BB">35</font><font color="#007700">,</font><font color="#0000BB">745</font><font color="#007700">,</font><font color="#0000BB">244</font><font color="#007700">);
<br /></font><font color="#0000BB">$datay4&nbsp;</font><font color="#007700">=&nbsp;array(</font><font color="#0000BB">130</font><font color="#007700">,</font><font color="#0000BB">97</font><font color="#007700">,</font><font color="#0000BB">68</font><font color="#007700">,</font><font color="#0000BB">119</font><font color="#007700">);
<br />
<br /></font><font color="#FF8000">//&nbsp;Setup&nbsp;the&nbsp;graph
<br /></font><font color="#0000BB">$graph&nbsp;</font><font color="#007700">=&nbsp;new&nbsp;</font><font color="#0000BB">Graph</font><font color="#007700">(</font><font color="#0000BB">600</font><font color="#007700">,</font><font color="#0000BB">250</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">SetMargin</font><font color="#007700">(</font><font color="#0000BB">30</font><font color="#007700">,</font><font color="#0000BB">200</font><font color="#007700">,</font><font color="#0000BB">20</font><font color="#007700">,</font><font color="#0000BB">20</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">SetMarginColor</font><font color="#007700">(</font><font color="#DD0000">'white'</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">SetColor</font><font color="#007700">(</font><font color="#DD0000">'lightgray'</font><font color="#007700">);
<br />
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">SetScale</font><font color="#007700">(</font><font color="#DD0000">"intlin"</font><font color="#007700">);
<br />
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">SetYScale</font><font color="#007700">(</font><font color="#0000BB">0</font><font color="#007700">,</font><font color="#DD0000">"lin"</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">SetYScale</font><font color="#007700">(</font><font color="#0000BB">1</font><font color="#007700">,</font><font color="#DD0000">"lin"</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">SetYScale</font><font color="#007700">(</font><font color="#0000BB">2</font><font color="#007700">,</font><font color="#DD0000">"lin"</font><font color="#007700">);
<br />
<br /></font><font color="#0000BB">$p1&nbsp;</font><font color="#007700">=&nbsp;new&nbsp;</font><font color="#0000BB">LinePlot</font><font color="#007700">(</font><font color="#0000BB">$datay</font><font color="#007700">);
<br /></font><font color="#0000BB">$p1</font><font color="#007700">-&gt;</font><font color="#0000BB">SetColor</font><font color="#007700">(</font><font color="#DD0000">'blue'</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">Add</font><font color="#007700">(</font><font color="#0000BB">$p1</font><font color="#007700">);
<br />
<br /></font><font color="#0000BB">$p2&nbsp;</font><font color="#007700">=&nbsp;new&nbsp;</font><font color="#0000BB">LinePlot</font><font color="#007700">(</font><font color="#0000BB">$datay2</font><font color="#007700">);
<br /></font><font color="#0000BB">$p2</font><font color="#007700">-&gt;</font><font color="#0000BB">SetColor</font><font color="#007700">(</font><font color="#DD0000">'darkred'</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">AddY</font><font color="#007700">(</font><font color="#0000BB">0</font><font color="#007700">,</font><font color="#0000BB">$p2</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">ynaxis</font><font color="#007700">[</font><font color="#0000BB">0</font><font color="#007700">]-&gt;</font><font color="#0000BB">SetColor</font><font color="#007700">(</font><font color="#DD0000">'darkred'</font><font color="#007700">);
<br />
<br /></font><font color="#0000BB">$p3&nbsp;</font><font color="#007700">=&nbsp;new&nbsp;</font><font color="#0000BB">LinePlot</font><font color="#007700">(</font><font color="#0000BB">$datay3</font><font color="#007700">);
<br /></font><font color="#0000BB">$p3</font><font color="#007700">-&gt;</font><font color="#0000BB">SetColor</font><font color="#007700">(</font><font color="#DD0000">'red'</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">AddY</font><font color="#007700">(</font><font color="#0000BB">1</font><font color="#007700">,</font><font color="#0000BB">$p3</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">ynaxis</font><font color="#007700">[</font><font color="#0000BB">1</font><font color="#007700">]-&gt;</font><font color="#0000BB">SetColor</font><font color="#007700">(</font><font color="#DD0000">'red'</font><font color="#007700">);
<br />
<br /></font><font color="#0000BB">$p4&nbsp;</font><font color="#007700">=&nbsp;new&nbsp;</font><font color="#0000BB">LinePlot</font><font color="#007700">(</font><font color="#0000BB">$datay4</font><font color="#007700">);
<br /></font><font color="#0000BB">$p4</font><font color="#007700">-&gt;</font><font color="#0000BB">SetColor</font><font color="#007700">(</font><font color="#DD0000">'blue'</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">AddY</font><font color="#007700">(</font><font color="#0000BB">2</font><font color="#007700">,</font><font color="#0000BB">$p4</font><font color="#007700">);
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">ynaxis</font><font color="#007700">[</font><font color="#0000BB">2</font><font color="#007700">]-&gt;</font><font color="#0000BB">SetColor</font><font color="#007700">(</font><font color="#DD0000">'blue'</font><font color="#007700">);
<br />
<br /></font><font color="#FF8000">//&nbsp;Output&nbsp;line
<br /></font><font color="#0000BB">$graph</font><font color="#007700">-&gt;</font><font color="#0000BB">Stroke</font><font color="#007700">();
<br />
<br /></font><font color="#0000BB">
<br /></font></font>
1654
 
1655
<p>
1656
 
1657
function&nbsp;Stroke($aStrokeFileName)</font>
1658
</b></div></a></span>
1659
 
1660
<span style='font-family:arial;font-size:90%;'><i>Stroke graph to browser or file</i></span><p>
1661
1662
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
1663
 
1664
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1665
$aStrokeFileName</font>
1666
 
1667
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1668
""</font>
1669
</td><td>File name* (or special handle, see below)</td></tr>
1670
</table>
1671
 
1672
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Should be the final method called in the script that generates a graph. This will generate the image and send it back to the browser.
1673
<p>
1674
If $aStrokeFileName != "" the image will be written to this file and NOT streamed back to the browser
1675
<p>
1676
If the file name is specified with the define __IMG_HANDLER (Note: Thre are 2 '_' in the  beginning) then no image will be streamed to file or browser. Instead the Stroke() method will simply return the image handle used by the GD library. This can come in handy of you like to post manipulate the image or use the raw GD image in other context. Such as in creating dynamic PDF documents.
1677
<p>
1678
Note: If you want to use the image in a PDF file you can't take the handle directly since this is a GD handle. To use it in PDF you must first create an PDF image by calling pdf_open_memory_image() to get a proper PDF image handle. See example below.
1679
 
1680
<p>
1681
You may also specify the file name as "auto" in which case the filename will be created from the script name but with the extension changed to reflect the choosen image format.
1682
&nbsp;<br>
1683
1684
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1685
//&nbsp;Example&nbsp;1&nbsp;:&nbsp;(Normal&nbsp;case)&nbsp;Stream&nbsp;back&nbsp;to&nbsp;browser
<br />$graph-&gt;Stroke();
<br />
<br />//&nbsp;Example&nbsp;2&nbsp;:&nbsp;Stream&nbsp;to&nbsp;the&nbsp;file&nbsp;with&nbsp;absolute&nbsp;file&nbsp;path
<br />$graph-&gt;Stroke($fileName);
<br />
<br />//&nbsp;Example&nbsp;3
<br />//&nbsp;Get&nbsp;the&nbsp;image&nbsp;handle.&nbsp;NOTE:&nbsp;No&nbsp;image&nbsp;will&nbsp;be&nbsp;
<br />//&nbsp;streamed&nbsp;to&nbsp;the&nbsp;browser&nbsp;in&nbsp;this&nbsp;case.
<br />$ih&nbsp;=&nbsp;$graph-&gt;Stroke(__IMG_HANDLER);
<br />
<br />//&nbsp;PDF&nbsp;example
<br />//....
<br />$im&nbsp;=&nbsp;$graph-&gt;Stroke(_IMG_HANDLER);
<br />$pdf&nbsp;=&nbsp;pdf_new();
<br />pdf_open_file($pdf,&nbsp;"");
<br />
<br />$pimg&nbsp;=&nbsp;pdf_open_memory_image($pdf,&nbsp;$im);
<br />pdf_begin_page($pdf,&nbsp;595,&nbsp;842);
<br />pdf_add_outline($pdf,&nbsp;"Page&nbsp;1");
<br />pdf_place_image($pdf,&nbsp;$pimg,&nbsp;0,&nbsp;500,&nbsp;1);&nbsp;
<br />pdf_close_image($pdf,&nbsp;$pimg);&nbsp;
<br />pdf_end_page($pdf);
<br />pdf_close($pdf);
<br />$buf&nbsp;=&nbsp;pdf_get_buffer($pdf);
<br />$len&nbsp;=&nbsp;strlen($buf);
<br />header("Content-type:&nbsp;application/pdf");
<br />header("Content-Length:&nbsp;$len");
<br />header("Content-Disposition:&nbsp;inline;&nbsp;filename=jpimage.pdf");
<br />echo&nbsp;$buf;
<br />pdf_delete($pdf);
<br />
<br />
<br />
<br />
<br /></font>
1686
</span><br>
1687
 
1688
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_GRAPH_STROKECSIM"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
1689
 
1690
</b></div></a></span>
1691
1692
<span style='font-family:arial;font-size:90%;'><i>Stroke an image with a CSIM</i></span><p>
1693
1694
 
1695
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
1696
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1697
$aScriptName</font>
1698
1699
 
1700
'auto'</font>
1701
 
1702
1703
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1704
$aCSIMName</font>
1705
1706
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1707
''</font>
1708
</td><td>Image map name</td></tr>
1709
 
1710
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1711
 
1712
1713
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
1714
0</font>
1715
</td><td>Should the image be bordered?</td></tr>
1716
 
1717
1718
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>To generate an CSIM you must use this method at the end of your script instead of the normal Graph::Stroke() method. This method does not send back an image to the browser but rather a HTML page which contains an image map and a "recursive call" back to the image script. See the full JpGraph manual for a detailed explanation on how this works.
1719
<p>
1720
 
1721
<p>
1722
Why that? Because it is impossible for JpGraph to find out the name of the script it is executed from in the case where it is included as oart of a "standard" HTML/PHP page. Using the PHP_SELF will only return the master document and not the actual script name.
1723
 
1724
If you use several image map images on the same HTML page you must also specify unique names of each of the image maps as the second argument for this function.
1725
<p>
1726
To specify targets for the image maps you must call the individual plots Pot::SetCSIMTargets()
1727
 
1728
Tip: You can easily specify the script name by using the construction
1729
basename(__FILE__) as the first argument&nbsp;<br>
1730
 
1731
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1732
...
<br />$graph-&gt;StrokeCSIM(basename(__FILE__));
<br /></font>
1733
</span><br>
1734
<p>
1735
 
1736
function&nbsp;StrokeFrameBackground()</font>
1737
</b></div></a></span>
1738
1739
<span style='font-family:arial;font-size:90%;'><i>Stroke the frames background and border</i></span><p>
1740
<br>
1741
1742
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Semi Internal routine. Exclusively used together with canvas graphs where object are added directly to the canvas and we therefore must make sure that the background is stroked first.
1743
&nbsp;<br>
1744
1745
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
1746
 
1747
</span><br>
1748
<p> <hr> <p>