| 1 |
lars |
1 |
<?php
|
|
|
2 |
// $Id: canvas_jpgarchex.php,v 1.3 2002/08/29 10:14:19 aditus Exp $
|
|
|
3 |
include "../jpgraph.php";
|
|
|
4 |
include "../jpgraph_canvas.php";
|
|
|
5 |
include "../jpgraph_canvtools.php";
|
|
|
6 |
|
|
|
7 |
// Scale we are using
|
|
|
8 |
$ymax=24;
|
|
|
9 |
$xmax=20;
|
|
|
10 |
|
|
|
11 |
// Setup the basic canvas
|
|
|
12 |
$g = new CanvasGraph(700,650,'auto');
|
|
|
13 |
$g->SetMargin(2,3,2,3);
|
|
|
14 |
$g->SetMarginColor("teal");
|
|
|
15 |
$g->InitFrame();
|
|
|
16 |
|
|
|
17 |
// ... and a scale
|
|
|
18 |
$scale = new CanvasScale($g);
|
|
|
19 |
$scale->Set(0,$xmax,0,$ymax);
|
|
|
20 |
|
|
|
21 |
// ... we need shape since we want the indented rectangle
|
|
|
22 |
$shape = new Shape($g,$scale);
|
|
|
23 |
$shape->SetColor('black');
|
|
|
24 |
|
|
|
25 |
// ... basic parameters for the overall image
|
|
|
26 |
$l = 2; // Left margin
|
|
|
27 |
$r = 18; // Row number to start the lowest line on
|
|
|
28 |
$width = 16; // Total width
|
|
|
29 |
|
|
|
30 |
// Setup the two basic rectangle text object we will use
|
|
|
31 |
$tt = new CanvasRectangleText();
|
|
|
32 |
$tt->SetFont(FF_ARIAL,FS_NORMAL,14);
|
|
|
33 |
$tt->SetFillColor('');
|
|
|
34 |
$tt->SetColor('');
|
|
|
35 |
$tt->SetFontColor('navy');
|
|
|
36 |
|
|
|
37 |
$t = new CanvasRectangleText();
|
|
|
38 |
$t->SetFont(FF_ARIAL,FS_NORMAL,14);
|
|
|
39 |
$t->SetFillColor('goldenrod1');
|
|
|
40 |
$t->SetFontColor('navy');
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
// Now start drawing the arch overview from the bottom and up
|
|
|
44 |
// This is all pretty manual and one day I will write a proper
|
|
|
45 |
// framework to make it easy to construct these types of architecture
|
|
|
46 |
// overviews. But for now, just plain old coordinates..
|
|
|
47 |
|
|
|
48 |
// Line: GD Library and image libraries
|
|
|
49 |
$h=3;
|
|
|
50 |
$s = 3; $d=$l + $width-9;
|
|
|
51 |
$t->SetFillColor('cadetblue3');
|
|
|
52 |
$t->Set("TTF",$d,$r+2,$s,1);
|
|
|
53 |
$t->Stroke($g->img,$scale);
|
|
|
54 |
$t->Set("PNG",$d+$s,$r+2,$s,1);
|
|
|
55 |
$t->Stroke($g->img,$scale);
|
|
|
56 |
$t->Set("JPEG",$d+2*$s,$r+2,$s,1);
|
|
|
57 |
$t->Stroke($g->img,$scale);
|
|
|
58 |
$shape->IndentedRectangle($l,$r,$width,$h,$s*3,1,2,'lightgreen');
|
|
|
59 |
$tt->Set("GD Basic library\n(1.8.x or 2.x)",$l,$r,$width,$h-1);
|
|
|
60 |
$tt->Stroke($g->img,$scale);
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
// Area: Basic internal JpGraph architecture
|
|
|
64 |
$t->SetFillColor('goldenrod1');
|
|
|
65 |
$h = 2;
|
|
|
66 |
$r -= $h; $d=8;
|
|
|
67 |
$t->Set("Image primitives\n(RGB, Anti-aliasing,\nGD Abstraction)",$l,$r-0.5,$width*0.5,$h+0.5);
|
|
|
68 |
$t->Stroke($g->img,$scale);
|
|
|
69 |
$t->Set("Image Cache &\nStreaming",$l+0.5*$width,$r,$width*0.4,$h);
|
|
|
70 |
$t->Stroke($g->img,$scale);
|
|
|
71 |
|
|
|
72 |
$r -= $h; $d=8;
|
|
|
73 |
$t->Set("2D Rot & Transformation",$l,$r,$width*0.5,$h-0.5); $t->Stroke($g->img,$scale);
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
$r -= 2; $h = 4;
|
|
|
77 |
$shape->IndentedRectangle($l,$r,$width*0.9,$h,$d,2,3,'goldenrod1');
|
|
|
78 |
$tt->Set("Axis, Labelling, (Auto)-Scaling",$l,$r,$width*0.9,$h-2); $tt->Stroke($g->img,$scale);
|
|
|
79 |
|
|
|
80 |
$r -= 1;
|
|
|
81 |
$shape->IndentedRectangle($l,$r,$width,7,$width*0.9,6,3,'goldenrod1');
|
|
|
82 |
$tt->Set("Error handling & Utility classes",$l,$r,$width,1); $tt->Stroke($g->img,$scale);
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
// Area: Top area with graph components
|
|
|
86 |
$t->SetFillColor('gold1');
|
|
|
87 |
$r -= 3;
|
|
|
88 |
$w = $width*0.55/4; $h = 2;
|
|
|
89 |
$t->Set("Gantt\nGraph",$l,$r,$w,$h);
|
|
|
90 |
$t->Stroke($g->img,$scale);
|
|
|
91 |
|
|
|
92 |
$t->Set("Pie\nGraph",$l+$w,$r,$w,$h);
|
|
|
93 |
$t->Stroke($g->img,$scale);
|
|
|
94 |
$t->Set("Radar\nGraph",$l+$w*2,$r,$w,$h);
|
|
|
95 |
$t->Stroke($g->img,$scale);
|
|
|
96 |
|
|
|
97 |
$shape->IndentedRectangle($l,$r,$width,3,4*$w,2,0,'gold1');
|
|
|
98 |
$tt->Set("Base Graph\n(Orthogonal\ncoordinate system)",$l+4*$w,$r,$width-$w*4,3);
|
|
|
99 |
$tt->Stroke($g->img,$scale);
|
|
|
100 |
|
|
|
101 |
$r -= 2;
|
|
|
102 |
$d = 0.7;
|
|
|
103 |
$shape->IndentedRectangle($l+3*$w,$r,$w,4, $w*$d,2,0,'gold1');
|
|
|
104 |
$t->Set("Canv\nUtil",$l+3*$w,$r,$w*$d,$h); $t->Stroke($g->img,$scale);
|
|
|
105 |
$tt->Set("Canvas\nGraph",$l+3*$w,$r+2,$w,2); $tt->Stroke($g->img,$scale);
|
|
|
106 |
|
|
|
107 |
// Top line of plotting plugins
|
|
|
108 |
$t->SetFillColor('cyan');
|
|
|
109 |
$t->Set("Gantt\nPlot",$l,$r,$w,$h); $t->Stroke($g->img,$scale);
|
|
|
110 |
$t->Set("2D\nPlot",$l+$w,$r,$w/2,$h); $t->Stroke($g->img,$scale);
|
|
|
111 |
$t->Set("3D\nPlot",$l+$w+$w/2,$r,$w/2,$h);$t->Stroke($g->img,$scale);
|
|
|
112 |
$t->Set("Radar\nPlot",$l+2*$w,$r,$w,$h); $t->Stroke($g->img,$scale);
|
|
|
113 |
|
|
|
114 |
$wp = ($width - 4*$w)/4;
|
|
|
115 |
$t->Set("Error\nPlot",$l+4*$w,$r,$wp,$h); $t->Stroke($g->img,$scale);
|
|
|
116 |
$t->Set("Line\nPlot",$l+4*$w+$wp,$r,$wp,$h); $t->Stroke($g->img,$scale);
|
|
|
117 |
$t->Set("Bar\nPlot",$l+4*$w+2*$wp,$r,$wp,$h); $t->Stroke($g->img,$scale);
|
|
|
118 |
$t->Set("Scatter\nPlot",$l+4*$w+3*$wp,$r,$wp,$h); $t->Stroke($g->img,$scale);
|
|
|
119 |
|
|
|
120 |
// Show application top
|
|
|
121 |
$r -= 2.5; $h=2;
|
|
|
122 |
$t->SetFillColor('blue');
|
|
|
123 |
$t->SetFontColor('white');
|
|
|
124 |
$t->SetFont(FF_ARIAL,FS_BOLD,20);
|
|
|
125 |
$t->Set("PHP Application",$l,$r,$width,$h); $t->Stroke($g->img,$scale);
|
|
|
126 |
|
|
|
127 |
// Stroke title
|
|
|
128 |
$r = 0.5;
|
|
|
129 |
$tt->SetFontColor('black');
|
|
|
130 |
$tt->SetFont(FF_TIMES,FS_BOLD,28);
|
|
|
131 |
$tt->Set("JpGraph Architecture Overview",$l,$r,$width,1);
|
|
|
132 |
$tt->Stroke($g->img,$scale);
|
|
|
133 |
|
|
|
134 |
// Stroke footer
|
|
|
135 |
$tt->SetFont(FF_VERDANA,FS_NORMAL,10);
|
|
|
136 |
$tt->Set("Generated: ".date("ymd H:m",time()),0.1,$ymax*0.95);
|
|
|
137 |
$tt->Stroke($g->img,$scale);
|
|
|
138 |
|
|
|
139 |
// .. and stream it all back
|
|
|
140 |
$g->Stroke();
|
|
|
141 |
|
|
|
142 |
?>
|
|
|
143 |
|