Commit 8ec98c9f03bf97e5d94ffea8f5e44902edf00e9a
1 parent
d72ac078
MAJ
Showing
3191 changed files
with
63687 additions
and
168297 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 3191 files are displayed.
... | ... | @@ -0,0 +1,41 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +$data1y=array(-8,8,9,3,5,6); | |
7 | +$data2y=array(18,2,1,7,5,4); | |
8 | + | |
9 | +// Create the graph. These two calls are always required | |
10 | +$graph = new Graph(500,400); | |
11 | +$graph->cleartheme(); | |
12 | +$graph->SetScale("textlin"); | |
13 | + | |
14 | +$graph->SetShadow(); | |
15 | +$graph->img->SetMargin(40,30,20,40); | |
16 | + | |
17 | +// Create the bar plots | |
18 | +$b1plot = new BarPlot($data1y); | |
19 | +$b1plot->SetFillColor("orange"); | |
20 | +$b1plot->value->Show(); | |
21 | +$b2plot = new BarPlot($data2y); | |
22 | +$b2plot->SetFillColor("blue"); | |
23 | +$b2plot->value->Show(); | |
24 | + | |
25 | +// Create the grouped bar plot | |
26 | +$gbplot = new AccBarPlot(array($b1plot,$b2plot)); | |
27 | + | |
28 | +// ...and add it to the graPH | |
29 | +$graph->Add($gbplot); | |
30 | + | |
31 | +$graph->title->Set("Accumulated bar plots"); | |
32 | +$graph->xaxis->title->Set("X-title"); | |
33 | +$graph->yaxis->title->Set("Y-title"); | |
34 | + | |
35 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
36 | +$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
37 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
38 | + | |
39 | +// Display the graph | |
40 | +$graph->Stroke(); | |
41 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,31 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +$datay1=array(13,8,19,7,17,6); | |
6 | +$datay2=array(4,5,2,7,5,25); | |
7 | + | |
8 | +// Create the graph. | |
9 | +$graph = new Graph(350,250); | |
10 | +$graph->SetScale('textlin'); | |
11 | +$graph->SetMarginColor('white'); | |
12 | + | |
13 | +// Setup title | |
14 | +$graph->title->Set('Acc bar with gradient'); | |
15 | + | |
16 | +// Create the first bar | |
17 | +$bplot = new BarPlot($datay1); | |
18 | +$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT); | |
19 | +$bplot->SetColor('darkred'); | |
20 | + | |
21 | +// Create the second bar | |
22 | +$bplot2 = new BarPlot($datay2); | |
23 | +$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT); | |
24 | +$bplot2->SetColor('darkgreen'); | |
25 | + | |
26 | +// And join them in an accumulated bar | |
27 | +$accbplot = new AccBarPlot(array($bplot,$bplot2)); | |
28 | +$graph->Add($accbplot); | |
29 | + | |
30 | +$graph->Stroke(); | |
31 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,33 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +$datay1=array(13,8,19,7,17,6); | |
6 | +$datay2=array(4,5,2,7,5,25); | |
7 | + | |
8 | +// Create the graph. | |
9 | +$graph = new Graph(350,250); | |
10 | +$graph->SetScale('textlin'); | |
11 | +$graph->SetMarginColor('white'); | |
12 | + | |
13 | +// Setup title | |
14 | +$graph->title->Set('Acc bar with gradient'); | |
15 | + | |
16 | +// Create the first bar | |
17 | +$bplot = new BarPlot($datay1); | |
18 | +$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT); | |
19 | +$bplot->SetColor('darkred'); | |
20 | + | |
21 | +// Create the second bar | |
22 | +$bplot2 = new BarPlot($datay2); | |
23 | +$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT); | |
24 | +$bplot2->SetColor('darkgreen'); | |
25 | + | |
26 | +// And join them in an accumulated bar | |
27 | +$accbplot = new AccBarPlot(array($bplot,$bplot2)); | |
28 | +$accbplot->SetColor('red'); | |
29 | +$accbplot->SetWeight(1); | |
30 | +$graph->Add($accbplot); | |
31 | + | |
32 | +$graph->Stroke(); | |
33 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +$datay1=array(13,8,19,7,17,6); | |
6 | +$datay2=array(4,5,2,7,5,25); | |
7 | + | |
8 | +// Create the graph. | |
9 | +$graph = new Graph(350,250); | |
10 | +$graph->SetScale('textlin'); | |
11 | +$graph->SetMarginColor('white'); | |
12 | + | |
13 | +// Setup title | |
14 | +$graph->title->Set('Acc bar with gradient'); | |
15 | + | |
16 | +// Create the first bar | |
17 | +$bplot = new BarPlot($datay1); | |
18 | +$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT); | |
19 | +$bplot->SetColor('darkred'); | |
20 | +$bplot->SetWeight(0); | |
21 | + | |
22 | +// Create the second bar | |
23 | +$bplot2 = new BarPlot($datay2); | |
24 | +$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT); | |
25 | +$bplot2->SetColor('darkgreen'); | |
26 | +$bplot2->SetWeight(0); | |
27 | + | |
28 | +// And join them in an accumulated bar | |
29 | +$accbplot = new AccBarPlot(array($bplot,$bplot2)); | |
30 | +$accbplot->SetColor('darkgray'); | |
31 | +$accbplot->SetWeight(1); | |
32 | +$graph->Add($accbplot); | |
33 | + | |
34 | +$graph->Stroke(); | |
35 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,75 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// Some data | |
7 | +$datay1=array(140,110,50,60); | |
8 | +$datay2=array(35,90,190,190); | |
9 | +$datay3=array(20,60,70,140); | |
10 | + | |
11 | +// Create the basic graph | |
12 | +$graph = new Graph(450,250,'auto'); | |
13 | +$graph->clearTheme(); | |
14 | +$graph->SetScale("textlin"); | |
15 | +$graph->img->SetMargin(40,80,30,40); | |
16 | + | |
17 | +// Adjust the position of the legend box | |
18 | +$graph->legend->Pos(0.02,0.15); | |
19 | + | |
20 | +// Adjust the color for theshadow of the legend | |
21 | +$graph->legend->SetShadow('darkgray@0.5'); | |
22 | +$graph->legend->SetFillColor('lightblue@0.3'); | |
23 | + | |
24 | +// Get localised version of the month names | |
25 | +$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); | |
26 | + | |
27 | +// Set a nice summer (in Stockholm) image | |
28 | +$graph->SetBackgroundImage('stship.jpg',BGIMG_COPY); | |
29 | + | |
30 | +// Set axis titles and fonts | |
31 | +$graph->xaxis->title->Set('Year 2002'); | |
32 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
33 | +$graph->xaxis->title->SetColor('white'); | |
34 | + | |
35 | +$graph->xaxis->SetFont(FF_FONT1,FS_BOLD); | |
36 | +$graph->xaxis->SetColor('white'); | |
37 | + | |
38 | +$graph->yaxis->SetFont(FF_FONT1,FS_BOLD); | |
39 | +$graph->yaxis->SetColor('white'); | |
40 | + | |
41 | +//$graph->ygrid->Show(false); | |
42 | +$graph->ygrid->SetColor('white@0.5'); | |
43 | + | |
44 | +// Setup graph title | |
45 | +$graph->title->Set('Using alpha blending with a background'); | |
46 | +// Some extra margin (from the top) | |
47 | +$graph->title->SetMargin(3); | |
48 | +$graph->title->SetFont(FF_ARIAL,FS_NORMAL,12); | |
49 | + | |
50 | +// Create the three var series we will combine | |
51 | +$bplot1 = new BarPlot($datay1); | |
52 | +$bplot2 = new BarPlot($datay2); | |
53 | +$bplot3 = new BarPlot($datay3); | |
54 | + | |
55 | +// Setup the colors with 40% transparency (alpha channel) | |
56 | +$bplot1->SetFillColor('orange@0.4'); | |
57 | +$bplot2->SetFillColor('brown@0.4'); | |
58 | +$bplot3->SetFillColor('darkgreen@0.4'); | |
59 | + | |
60 | +// Setup legends | |
61 | +$bplot1->SetLegend('Label 1'); | |
62 | +$bplot2->SetLegend('Label 2'); | |
63 | +$bplot3->SetLegend('Label 3'); | |
64 | + | |
65 | +// Setup each bar with a shadow of 50% transparency | |
66 | +$bplot1->SetShadow('black@0.4'); | |
67 | +$bplot2->SetShadow('black@0.4'); | |
68 | +$bplot3->SetShadow('black@0.4'); | |
69 | + | |
70 | +$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3)); | |
71 | +$gbarplot->SetWidth(0.6); | |
72 | +$graph->Add($gbarplot); | |
73 | + | |
74 | +$graph->Stroke(); | |
75 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,18 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Antispam example using a random string | |
3 | +require_once "jpgraph/jpgraph_antispam.php"; | |
4 | + | |
5 | +// Create new anti-spam challenge creator | |
6 | +// Note: Neither '0' (digit) or 'O' (letter) can be used to avoid confusion | |
7 | +$spam = new AntiSpam(); | |
8 | + | |
9 | +// Create a random 5 char challenge and return the string generated | |
10 | +$chars = $spam->Rand(5); | |
11 | + | |
12 | +// Stroke random cahllenge | |
13 | +if( $spam->Stroke() === false ) { | |
14 | + die('Illegal or no data to plot'); | |
15 | +} | |
16 | + | |
17 | +?> | |
18 | + | |
... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?php | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | +require_once ('jpgraph/jpgraph_line.php'); | |
5 | + | |
6 | +$theme = isset($_GET['theme']) ? $_GET['theme'] : null; | |
7 | + | |
8 | +$data = array ( | |
9 | + 0 => array (0 => 79, 1 => -25, 2 => -7, 3 => 85, 4 => -26, 5 => -32, ), | |
10 | + 1 => array (0 => 76, 1 => 51, 2 => 86, 3 => 12, 4 => -7, 5 => 94, ), | |
11 | + 2 => array (0 => 49, 1 => 38, 2 => 7, 3 => -40, 4 => 9, 5 => -7, ), | |
12 | + 3 => array ( 0 => 69, 1 => 96, 2 => 49, 3 => 7, 4 => 92, 5 => -38, ), | |
13 | + 4 => array ( 0 => 68, 1 => 16, 2 => 82, 3 => -49, 4 => 50, 5 => 7, ), | |
14 | + 5 => array ( 0 => -37, 1 => 28, 2 => 32, 3 => 6, 4 => 13, 5 => 57, ), | |
15 | + 6 => array ( 0 => 24, 1 => -11, 2 => 7, 3 => 10, 4 => 51, 5 => 51, ), | |
16 | + 7 => array ( 0 => 3, 1 => -1, 2 => -12, 3 => 61, 4 => 10, 5 => 47, ), | |
17 | + 8 => array ( 0 => -47, 1 => -21, 2 => 43, 3 => 53, 4 => 36, 5 => 34, ), | |
18 | +); | |
19 | + | |
20 | + | |
21 | +// Create the graph. These two calls are always required | |
22 | +$graph = new Graph(400,300); | |
23 | + | |
24 | +$graph->SetScale("textlin"); | |
25 | +if ($theme) { | |
26 | + $graph->SetTheme(new $theme()); | |
27 | +} | |
28 | +$theme_class = new AquaTheme; | |
29 | +$graph->SetTheme($theme_class); | |
30 | + | |
31 | +$plot = array(); | |
32 | +// Create the bar plots | |
33 | +for ($i = 0; $i < 4; $i++) { | |
34 | + $plot[$i] = new BarPlot($data[$i]); | |
35 | + $plot[$i]->SetLegend('plot'.($i+1)); | |
36 | +} | |
37 | +//$acc1 = new AccBarPlot(array($plot[0], $plot[1])); | |
38 | +//$acc1->value->Show(); | |
39 | +$gbplot = new GroupBarPlot(array($plot[2], $plot[1] )); | |
40 | + | |
41 | +for ($i = 4; $i < 8; $i++) { | |
42 | + $plot[$i] = new LinePlot($data[$i]); | |
43 | + $plot[$i]->SetLegend('plot'.$i); | |
44 | + $plot[$i]->value->Show(); | |
45 | +} | |
46 | + | |
47 | +$graph->Add($gbplot); | |
48 | +$graph->Add($plot[4]); | |
49 | + | |
50 | +$title = "AquaTheme Example"; | |
51 | +$title = mb_convert_encoding($title,'UTF-8'); | |
52 | +$graph->title->Set($title); | |
53 | +$graph->xaxis->title->Set("X-title"); | |
54 | +$graph->yaxis->title->Set("Y-title"); | |
55 | + | |
56 | +// Display the graph | |
57 | +$graph->Stroke(); | |
58 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +$ydata = array(12,19,3,9,15,10); | |
6 | + | |
7 | +// The code to setup a very basic graph | |
8 | +$graph = new Graph(200,150); | |
9 | +$graph->SetScale('intlin'); | |
10 | +$graph->SetMargin(30,15,40,30); | |
11 | +$graph->SetMarginColor('white'); | |
12 | +$graph->SetFrame(true,'blue',3); | |
13 | + | |
14 | +$graph->title->Set('Label background'); | |
15 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
16 | + | |
17 | +$graph->subtitle->SetFont(FF_ARIAL,FS_NORMAL,10); | |
18 | +$graph->subtitle->SetColor('darkred'); | |
19 | +$graph->subtitle->Set('"LABELBKG_NONE"'); | |
20 | + | |
21 | +$graph->SetAxisLabelBackground(LABELBKG_NONE,'orange','red','lightblue','red'); | |
22 | + | |
23 | +// Use Ariel font | |
24 | +$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
25 | +$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
26 | +$graph->xgrid->Show(); | |
27 | + | |
28 | +// Create the plot line | |
29 | +$p1 = new LinePlot($ydata); | |
30 | +$graph->Add($p1); | |
31 | + | |
32 | +// Output graph | |
33 | +$graph->Stroke(); | |
34 | + | |
35 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +$ydata = array(12,19,3,9,15,10); | |
6 | + | |
7 | +// The code to setup a very basic graph | |
8 | +$graph = new Graph(200,150); | |
9 | +$graph->SetScale('intlin'); | |
10 | +$graph->SetMargin(30,15,40,30); | |
11 | +$graph->SetMarginColor('white'); | |
12 | +$graph->SetFrame(true,'blue',3); | |
13 | + | |
14 | +$graph->title->Set('Label background'); | |
15 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
16 | + | |
17 | +$graph->subtitle->SetFont(FF_ARIAL,FS_NORMAL,10); | |
18 | +$graph->subtitle->SetColor('darkred'); | |
19 | +$graph->subtitle->Set('"LABELBKG_XAXIS"'); | |
20 | + | |
21 | +$graph->SetAxisLabelBackground(LABELBKG_XAXIS,'orange','red','lightblue','red'); | |
22 | + | |
23 | +// Use Ariel font | |
24 | +$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
25 | +$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
26 | +$graph->xgrid->Show(); | |
27 | + | |
28 | +// Create the plot line | |
29 | +$p1 = new LinePlot($ydata); | |
30 | +$graph->Add($p1); | |
31 | + | |
32 | +// Output graph | |
33 | +$graph->Stroke(); | |
34 | + | |
35 | +?> | |
36 | + | |
37 | + | |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +$ydata = array(12,19,3,9,15,10); | |
6 | + | |
7 | +// The code to setup a very basic graph | |
8 | +$graph = new Graph(200,150); | |
9 | +$graph->SetScale('intlin'); | |
10 | +$graph->SetMargin(30,15,40,30); | |
11 | +$graph->SetMarginColor('white'); | |
12 | +$graph->SetFrame(true,'blue',3); | |
13 | + | |
14 | +$graph->title->Set('Label background'); | |
15 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
16 | + | |
17 | +$graph->subtitle->SetFont(FF_ARIAL,FS_NORMAL,10); | |
18 | +$graph->subtitle->SetColor('darkred'); | |
19 | +$graph->subtitle->Set('"LABELBKG_YAXIS"'); | |
20 | + | |
21 | +$graph->SetAxisLabelBackground(LABELBKG_YAXIS,'orange','red','lightblue','red'); | |
22 | + | |
23 | +// Use Ariel font | |
24 | +$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
25 | +$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
26 | +$graph->xgrid->Show(); | |
27 | + | |
28 | +// Create the plot line | |
29 | +$p1 = new LinePlot($ydata); | |
30 | +$graph->Add($p1); | |
31 | + | |
32 | +// Output graph | |
33 | +$graph->Stroke(); | |
34 | + | |
35 | +?> | |
36 | + | |
37 | + | |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +$ydata = array(12,19,3,9,15,10); | |
6 | + | |
7 | +// The code to setup a very basic graph | |
8 | +$graph = new Graph(200,150); | |
9 | +$graph->SetScale('intlin'); | |
10 | +$graph->SetMargin(30,15,40,30); | |
11 | +$graph->SetMarginColor('white'); | |
12 | +$graph->SetFrame(true,'blue',3); | |
13 | + | |
14 | +$graph->title->Set('Label background'); | |
15 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
16 | + | |
17 | +$graph->subtitle->SetFont(FF_ARIAL,FS_NORMAL,10); | |
18 | +$graph->subtitle->SetColor('darkred'); | |
19 | +$graph->subtitle->Set('"LABELBKG_YAXISFULL"'); | |
20 | + | |
21 | +$graph->SetAxisLabelBackground(LABELBKG_YAXISFULL,'orange','red','lightblue','red'); | |
22 | + | |
23 | +// Use Ariel font | |
24 | +$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
25 | +$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
26 | +$graph->xgrid->Show(); | |
27 | + | |
28 | +// Create the plot line | |
29 | +$p1 = new LinePlot($ydata); | |
30 | +$graph->Add($p1); | |
31 | + | |
32 | +// Output graph | |
33 | +$graph->Stroke(); | |
34 | + | |
35 | +?> | |
36 | + | |
37 | + | |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +$ydata = array(12,19,3,9,15,10); | |
6 | + | |
7 | +// The code to setup a very basic graph | |
8 | +$graph = new Graph(200,150); | |
9 | +$graph->SetScale('intlin'); | |
10 | +$graph->SetMargin(30,15,40,30); | |
11 | +$graph->SetMarginColor('white'); | |
12 | +$graph->SetFrame(true,'blue',3); | |
13 | + | |
14 | +$graph->title->Set('Label background'); | |
15 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
16 | + | |
17 | +$graph->subtitle->SetFont(FF_ARIAL,FS_NORMAL,10); | |
18 | +$graph->subtitle->SetColor('darkred'); | |
19 | +$graph->subtitle->Set('"LABELBKG_XAXISFULL"'); | |
20 | + | |
21 | +$graph->SetAxisLabelBackground(LABELBKG_XAXISFULL,'orange','red','lightblue','red'); | |
22 | + | |
23 | +// Use Ariel font | |
24 | +$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
25 | +$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
26 | +$graph->xgrid->Show(); | |
27 | + | |
28 | +// Create the plot line | |
29 | +$p1 = new LinePlot($ydata); | |
30 | +$graph->Add($p1); | |
31 | + | |
32 | +// Output graph | |
33 | +$graph->Stroke(); | |
34 | + | |
35 | +?> | |
36 | + | |
37 | + | |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +$ydata = array(12,19,3,9,15,10); | |
6 | + | |
7 | +// The code to setup a very basic graph | |
8 | +$graph = new Graph(200,150); | |
9 | +$graph->SetScale('intlin'); | |
10 | +$graph->SetMargin(30,15,40,30); | |
11 | +$graph->SetMarginColor('white'); | |
12 | +$graph->SetFrame(true,'blue',3); | |
13 | + | |
14 | +$graph->title->Set('Label background'); | |
15 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
16 | + | |
17 | +$graph->subtitle->SetFont(FF_ARIAL,FS_NORMAL,10); | |
18 | +$graph->subtitle->SetColor('darkred'); | |
19 | +$graph->subtitle->Set('"LABELBKG_XYFULL"'); | |
20 | + | |
21 | +$graph->SetAxisLabelBackground(LABELBKG_XYFULL,'orange','red','lightblue','red'); | |
22 | + | |
23 | +// Use Ariel font | |
24 | +$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
25 | +$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
26 | +$graph->xgrid->Show(); | |
27 | + | |
28 | +// Create the plot line | |
29 | +$p1 = new LinePlot($ydata); | |
30 | +$graph->Add($p1); | |
31 | + | |
32 | +// Output graph | |
33 | +$graph->Stroke(); | |
34 | + | |
35 | +?> | |
36 | + | |
37 | + | |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +$ydata = array(12,19,3,9,15,10); | |
6 | + | |
7 | +// The code to setup a very basic graph | |
8 | +$graph = new Graph(200,150); | |
9 | +$graph->SetScale('intlin'); | |
10 | +$graph->SetMargin(30,15,40,30); | |
11 | +$graph->SetMarginColor('white'); | |
12 | +$graph->SetFrame(true,'blue',3); | |
13 | + | |
14 | +$graph->title->Set('Label background'); | |
15 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
16 | + | |
17 | +$graph->subtitle->SetFont(FF_ARIAL,FS_NORMAL,10); | |
18 | +$graph->subtitle->SetColor('darkred'); | |
19 | +$graph->subtitle->Set('"LABELBKG_XY"'); | |
20 | + | |
21 | +$graph->SetAxisLabelBackground(LABELBKG_XY,'orange','red','lightblue','red'); | |
22 | + | |
23 | +// Use Ariel font | |
24 | +$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
25 | +$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9); | |
26 | +$graph->xgrid->Show(); | |
27 | + | |
28 | +// Create the plot line | |
29 | +$p1 = new LinePlot($ydata); | |
30 | +$graph->Add($p1); | |
31 | + | |
32 | +// Output graph | |
33 | +$graph->Stroke(); | |
34 | + | |
35 | +?> | |
36 | + | |
37 | + | |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$ydata = array(11,3,8,12,5,1,9,13,5,7); | |
7 | + | |
8 | +// Create the graph. These two calls are always required | |
9 | +$graph = new Graph(350,250); | |
10 | +$graph->clearTheme(); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->SetMargin(40,40,50,50); | |
13 | + | |
14 | +// Setup the grid and plotarea box | |
15 | +$graph->ygrid->SetLineStyle('dashed'); | |
16 | +$graph->ygrid->setColor('darkgray'); | |
17 | +$graph->SetBox(true); | |
18 | + | |
19 | +// Steup graph titles | |
20 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
21 | +$graph->title->Set('Using background image'); | |
22 | +$graph->subtitle->SetFont(FF_COURIER,FS_BOLD,11); | |
23 | +$graph->subtitle->Set('"BGIMG_COPY"'); | |
24 | +$graph->subtitle->SetColor('darkred'); | |
25 | + | |
26 | +// Add background with 25% mix | |
27 | +$graph->SetBackgroundImage('heat1.jpg',BGIMG_COPY); | |
28 | +$graph->SetBackgroundImageMix(25); | |
29 | + | |
30 | +// Create the linear plot | |
31 | +$lineplot=new LinePlot($ydata); | |
32 | +$lineplot->SetColor("blue"); | |
33 | + | |
34 | +// Add the plot to the graph | |
35 | +$graph->Add($lineplot); | |
36 | + | |
37 | +// Display the graph | |
38 | +$graph->Stroke(); | |
39 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$ydata = array(11,3,8,12,5,1,9,13,5,7); | |
7 | + | |
8 | +// Create the graph. These two calls are always required | |
9 | +$graph = new Graph(350,250); | |
10 | +$graph->clearTheme(); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->SetMargin(40,40,50,50); | |
13 | + | |
14 | +// Setup the grid and plotarea box | |
15 | +$graph->ygrid->SetLineStyle('dashed'); | |
16 | +$graph->ygrid->setColor('darkgray'); | |
17 | +$graph->SetBox(true); | |
18 | + | |
19 | +// Steup graph titles | |
20 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
21 | +$graph->title->Set('Using background image'); | |
22 | +$graph->subtitle->SetFont(FF_COURIER,FS_BOLD,11); | |
23 | +$graph->subtitle->Set('"BGIMG_CENTER"'); | |
24 | +$graph->subtitle->SetColor('darkred'); | |
25 | + | |
26 | +// Add background with 25% mix | |
27 | +$graph->SetBackgroundImage('heat1.jpg',BGIMG_CENTER); | |
28 | +$graph->SetBackgroundImageMix(25); | |
29 | + | |
30 | +// Create the linear plot | |
31 | +$lineplot=new LinePlot($ydata); | |
32 | +$lineplot->SetColor("blue"); | |
33 | + | |
34 | +// Add the plot to the graph | |
35 | +$graph->Add($lineplot); | |
36 | + | |
37 | +// Display the graph | |
38 | +$graph->Stroke(); | |
39 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$ydata = array(11,3,8,12,5,1,9,13,5,7); | |
7 | + | |
8 | +// Create the graph. These two calls are always required | |
9 | +$graph = new Graph(350,250); | |
10 | +$graph->clearTheme(); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->SetMargin(40,40,50,50); | |
13 | + | |
14 | +// Setup the grid and plotarea box | |
15 | +$graph->ygrid->SetLineStyle('dashed'); | |
16 | +$graph->ygrid->setColor('darkgray'); | |
17 | +$graph->SetBox(true); | |
18 | + | |
19 | +// Steup graph titles | |
20 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
21 | +$graph->title->Set('Using background image'); | |
22 | +$graph->subtitle->SetFont(FF_COURIER,FS_BOLD,11); | |
23 | +$graph->subtitle->Set('"BGIMG_FREE"'); | |
24 | +$graph->subtitle->SetColor('darkred'); | |
25 | + | |
26 | +// Add background with 25% mix | |
27 | +$graph->SetBackgroundImage('heat1.jpg',BGIMG_FREE); | |
28 | +$graph->SetBackgroundImageMix(25); | |
29 | + | |
30 | +// Create the linear plot | |
31 | +$lineplot=new LinePlot($ydata); | |
32 | +$lineplot->SetColor("blue"); | |
33 | + | |
34 | +// Add the plot to the graph | |
35 | +$graph->Add($lineplot); | |
36 | + | |
37 | +// Display the graph | |
38 | +$graph->Stroke(); | |
39 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$ydata = array(11,3,8,12,5,1,9,13,5,7); | |
7 | + | |
8 | +// Create the graph. These two calls are always required | |
9 | +$graph = new Graph(350,250); | |
10 | +$graph->clearTheme(); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->SetMargin(40,40,50,50); | |
13 | + | |
14 | +// Setup the grid and plotarea box | |
15 | +$graph->ygrid->SetLineStyle('dashed'); | |
16 | +$graph->ygrid->setColor('darkgray'); | |
17 | +$graph->SetBox(true); | |
18 | + | |
19 | +// Steup graph titles | |
20 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
21 | +$graph->title->Set('Using background image'); | |
22 | +$graph->subtitle->SetFont(FF_COURIER,FS_BOLD,11); | |
23 | +$graph->subtitle->Set('"BGIMG_FILLPLOT"'); | |
24 | +$graph->subtitle->SetColor('darkred'); | |
25 | + | |
26 | +// Add background with 25% mix | |
27 | +$graph->SetBackgroundImage('heat1.jpg',BGIMG_FILLPLOT); | |
28 | +$graph->SetBackgroundImageMix(25); | |
29 | + | |
30 | +// Create the linear plot | |
31 | +$lineplot=new LinePlot($ydata); | |
32 | +$lineplot->SetColor("blue"); | |
33 | + | |
34 | +// Add the plot to the graph | |
35 | +$graph->Add($lineplot); | |
36 | + | |
37 | +// Display the graph | |
38 | +$graph->Stroke(); | |
39 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$ydata = array(11,3,8,12,5,1,9,13,5,7); | |
7 | + | |
8 | +// Create the graph. These two calls are always required | |
9 | +$graph = new Graph(350,250); | |
10 | +$graph->clearTheme(); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->SetMargin(40,40,50,50); | |
13 | + | |
14 | +// Setup the grid and plotarea box | |
15 | +$graph->ygrid->SetLineStyle('dashed'); | |
16 | +$graph->ygrid->setColor('darkgray'); | |
17 | +$graph->SetBox(true); | |
18 | + | |
19 | +// Steup graph titles | |
20 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
21 | +$graph->title->Set('Using background image'); | |
22 | +$graph->subtitle->SetFont(FF_COURIER,FS_BOLD,11); | |
23 | +$graph->subtitle->Set('"BGIMG_FILLFRAME"'); | |
24 | +$graph->subtitle->SetColor('darkred'); | |
25 | + | |
26 | +// Add background with 25% mix | |
27 | +$graph->SetBackgroundImage('heat1.jpg',BGIMG_FILLFRAME); | |
28 | +$graph->SetBackgroundImageMix(25); | |
29 | + | |
30 | +// Create the linear plot | |
31 | +$lineplot=new LinePlot($ydata); | |
32 | +$lineplot->SetColor("blue"); | |
33 | + | |
34 | +// Add the plot to the graph | |
35 | +$graph->Add($lineplot); | |
36 | + | |
37 | +// Display the graph | |
38 | +$graph->Stroke(); | |
39 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,50 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$datay = array(28,19,18,23,12,11); | |
7 | +$data2y = array(14,18,33,29,39,55); | |
8 | + | |
9 | +// A nice graph with anti-aliasing | |
10 | +$graph = new Graph(400,200); | |
11 | +$graph->clearTheme(); | |
12 | +$graph->img->SetMargin(40,180,40,40); | |
13 | +$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLPLOT); | |
14 | + | |
15 | +$graph->img->SetAntiAliasing("white"); | |
16 | +$graph->SetScale("textlin"); | |
17 | +$graph->SetShadow(); | |
18 | +$graph->title->Set("Background image"); | |
19 | + | |
20 | +// Use built in font | |
21 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
22 | + | |
23 | +// Slightly adjust the legend from it's default position in the | |
24 | +// top right corner. | |
25 | +$graph->legend->Pos(0.05,0.5,"right","center"); | |
26 | + | |
27 | +// Create the first line | |
28 | +$p1 = new LinePlot($datay); | |
29 | +$p1->mark->SetType(MARK_FILLEDCIRCLE); | |
30 | +$p1->mark->SetFillColor("red"); | |
31 | +$p1->mark->SetWidth(4); | |
32 | +$p1->SetColor("blue"); | |
33 | +$p1->SetCenter(); | |
34 | +$p1->SetLegend("Triumph Tiger -98"); | |
35 | +$graph->Add($p1); | |
36 | + | |
37 | +// ... and the second | |
38 | +$p2 = new LinePlot($data2y); | |
39 | +$p2->mark->SetType(MARK_STAR); | |
40 | +$p2->mark->SetFillColor("red"); | |
41 | +$p2->mark->SetWidth(4); | |
42 | +$p2->SetColor("red"); | |
43 | +$p2->SetCenter(); | |
44 | +$p2->SetLegend("New tiger -99"); | |
45 | +$graph->Add($p2); | |
46 | + | |
47 | +// Output line | |
48 | +$graph->Stroke(); | |
49 | + | |
50 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,50 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$datay = array(28,19,18,23,12,11); | |
7 | +$data2y = array(14,18,33,29,39,55); | |
8 | + | |
9 | +// A nice graph with anti-aliasing | |
10 | +$graph = new Graph(400,200); | |
11 | +$graph->clearTheme(); | |
12 | +$graph->img->SetMargin(40,180,40,40); | |
13 | +$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME); | |
14 | + | |
15 | +$graph->img->SetAntiAliasing(); | |
16 | +$graph->SetScale("textlin"); | |
17 | +$graph->SetShadow(); | |
18 | +$graph->title->Set("Background image"); | |
19 | + | |
20 | +// Use built in font | |
21 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
22 | + | |
23 | +// Slightly adjust the legend from it's default position in the | |
24 | +// top right corner. | |
25 | +$graph->legend->Pos(0.05,0.5,"right","center"); | |
26 | + | |
27 | +// Create the first line | |
28 | +$p1 = new LinePlot($datay); | |
29 | +$p1->mark->SetType(MARK_FILLEDCIRCLE); | |
30 | +$p1->mark->SetFillColor("red"); | |
31 | +$p1->mark->SetWidth(4); | |
32 | +$p1->SetColor("blue"); | |
33 | +$p1->SetCenter(); | |
34 | +$p1->SetLegend("Triumph Tiger -98"); | |
35 | +$graph->Add($p1); | |
36 | + | |
37 | +// ... and the second | |
38 | +$p2 = new LinePlot($data2y); | |
39 | +$p2->mark->SetType(MARK_STAR); | |
40 | +$p2->mark->SetFillColor("red"); | |
41 | +$p2->mark->SetWidth(4); | |
42 | +$p2->SetColor("red"); | |
43 | +$p2->SetCenter(); | |
44 | +$p2->SetLegend("New tiger -99"); | |
45 | +$graph->Add($p2); | |
46 | + | |
47 | +// Output line | |
48 | +$graph->Stroke(); | |
49 | + | |
50 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,50 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$datay = array(28,19,18,23,12,11); | |
7 | +$data2y = array(14,18,33,29,39,55); | |
8 | + | |
9 | +// A nice graph with anti-aliasing | |
10 | +$graph = new Graph(400,200); | |
11 | +$graph->clearTheme(); | |
12 | +$graph->img->SetMargin(40,180,40,40); | |
13 | +$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_COPY); | |
14 | + | |
15 | +$graph->img->SetAntiAliasing("white"); | |
16 | +$graph->SetScale("textlin"); | |
17 | +$graph->SetShadow(); | |
18 | +$graph->title->Set("Background image"); | |
19 | + | |
20 | +// Use built in font | |
21 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
22 | + | |
23 | +// Slightly adjust the legend from it's default position in the | |
24 | +// top right corner. | |
25 | +$graph->legend->Pos(0.05,0.5,"right","center"); | |
26 | + | |
27 | +// Create the first line | |
28 | +$p1 = new LinePlot($datay); | |
29 | +$p1->mark->SetType(MARK_FILLEDCIRCLE); | |
30 | +$p1->mark->SetFillColor("red"); | |
31 | +$p1->mark->SetWidth(4); | |
32 | +$p1->SetColor("blue"); | |
33 | +$p1->SetCenter(); | |
34 | +$p1->SetLegend("Triumph Tiger -98"); | |
35 | +$graph->Add($p1); | |
36 | + | |
37 | +// ... and the second | |
38 | +$p2 = new LinePlot($data2y); | |
39 | +$p2->mark->SetType(MARK_STAR); | |
40 | +$p2->mark->SetFillColor("red"); | |
41 | +$p2->mark->SetWidth(4); | |
42 | +$p2->SetColor("red"); | |
43 | +$p2->SetCenter(); | |
44 | +$p2->SetLegend("New tiger -99"); | |
45 | +$graph->Add($p2); | |
46 | + | |
47 | +// Output line | |
48 | +$graph->Stroke(); | |
49 | + | |
50 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,55 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: balloonex1.php,v 1.5 2002/12/15 16:08:51 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_scatter.php'); | |
5 | + | |
6 | +// Some data | |
7 | +$datax = array(1,2,3,4,5,6,7,8); | |
8 | +$datay = array(12,23,95,18,65,28,86,44); | |
9 | +// Callback for markers | |
10 | +// Must return array(width,color,fill_color) | |
11 | +// If any of the returned values are "" then the | |
12 | +// default value for that parameter will be used. | |
13 | +function FCallback($aVal) { | |
14 | + // This callback will adjust the fill color and size of | |
15 | + // the datapoint according to the data value according to | |
16 | + if( $aVal < 30 ) $c = "blue"; | |
17 | + elseif( $aVal < 70 ) $c = "green"; | |
18 | + else $c="red"; | |
19 | + return array(floor($aVal/3),"",$c); | |
20 | +} | |
21 | + | |
22 | +// Setup a basic graph | |
23 | +$graph = new Graph(400,300,'auto'); | |
24 | +$graph->clearTheme(); | |
25 | +$graph->SetScale("linlin"); | |
26 | +$graph->img->SetMargin(40,100,40,40); | |
27 | +$graph->SetShadow(); | |
28 | +$graph->title->Set("Example of ballon scatter plot"); | |
29 | +// Use a lot of grace to get large scales | |
30 | +$graph->yaxis->scale->SetGrace(50,10); | |
31 | + | |
32 | +// Make sure X-axis as at the bottom of the graph | |
33 | +$graph->xaxis->SetPos('min'); | |
34 | + | |
35 | +// Create the scatter plot | |
36 | +$sp1 = new ScatterPlot($datay,$datax); | |
37 | +$sp1->mark->SetType(MARK_FILLEDCIRCLE); | |
38 | + | |
39 | +// Uncomment the following two lines to display the values | |
40 | +$sp1->value->Show(); | |
41 | +$sp1->value->SetFont(FF_FONT1,FS_BOLD); | |
42 | + | |
43 | +// Specify the callback | |
44 | +$sp1->mark->SetCallback("FCallback"); | |
45 | + | |
46 | +// Setup the legend for plot | |
47 | +$sp1->SetLegend('Year 2002'); | |
48 | + | |
49 | +// Add the scatter plot to the graph | |
50 | +$graph->Add($sp1); | |
51 | + | |
52 | +// ... and send to browser | |
53 | +$graph->Stroke(); | |
54 | + | |
55 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,80 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_scatter.php'); | |
4 | + | |
5 | +// Each ballon is specificed by four values. | |
6 | +// (X,Y,Size,Color) | |
7 | +$data = array( | |
8 | + array(1,12,10,'orange'), | |
9 | + array(3,41,15,'red'), | |
10 | + array(4,5,19,'lightblue'), | |
11 | + array(5,70,22,'yellow') | |
12 | +); | |
13 | + | |
14 | + | |
15 | + | |
16 | +// We need to create X,Y data vectors suitable for the | |
17 | +// library from the above raw data. | |
18 | +$n = count($data); | |
19 | +for( $i=0; $i < $n; ++$i ) { | |
20 | + | |
21 | + $datax[$i] = $data[$i][0]; | |
22 | + $datay[$i] = $data[$i][1]; | |
23 | + | |
24 | + // Create a faster lookup array so we don't have to search | |
25 | + // for the correct values in the callback function | |
26 | + $format[strval($datax[$i])][strval($datay[$i])] = array($data[$i][2],$data[$i][3]); | |
27 | + | |
28 | +} | |
29 | + | |
30 | + | |
31 | +// Callback for markers | |
32 | +// Must return array(width,border_color,fill_color,filename,imgscale) | |
33 | +// If any of the returned values are '' then the | |
34 | +// default value for that parameter will be used (possible empty) | |
35 | +function FCallback($aYVal,$aXVal) { | |
36 | + global $format; | |
37 | + return array($format[strval($aXVal)][strval($aYVal)][0],'', | |
38 | + $format[strval($aXVal)][strval($aYVal)][1],'',''); | |
39 | +} | |
40 | + | |
41 | +// Setup a basic graph | |
42 | +$graph = new Graph(450,300,'auto'); | |
43 | +$graph->clearTheme(); | |
44 | +$graph->SetScale("intlin"); | |
45 | +$graph->SetMargin(40,40,40,40); | |
46 | +$graph->SetMarginColor('wheat'); | |
47 | + | |
48 | +$graph->title->Set("Example of ballon scatter plot with X,Y callback"); | |
49 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
50 | +$graph->title->SetMargin(10); | |
51 | + | |
52 | +// Use a lot of grace to get large scales since the ballon have | |
53 | +// size and we don't want them to collide with the X-axis | |
54 | +$graph->yaxis->scale->SetGrace(50,10); | |
55 | +$graph->xaxis->scale->SetGrace(50,10); | |
56 | + | |
57 | +// Make sure X-axis as at the bottom of the graph and not at the default Y=0 | |
58 | +$graph->xaxis->SetPos('min'); | |
59 | + | |
60 | +// Set X-scale to start at 0 | |
61 | +$graph->xscale->SetAutoMin(0); | |
62 | + | |
63 | +// Create the scatter plot | |
64 | +$sp1 = new ScatterPlot($datay,$datax); | |
65 | +$sp1->mark->SetType(MARK_FILLEDCIRCLE); | |
66 | + | |
67 | +// Uncomment the following two lines to display the values | |
68 | +$sp1->value->Show(); | |
69 | +$sp1->value->SetFont(FF_FONT1,FS_BOLD); | |
70 | + | |
71 | +// Specify the callback | |
72 | +$sp1->mark->SetCallbackYX("FCallback"); | |
73 | + | |
74 | +// Add the scatter plot to the graph | |
75 | +$graph->Add($sp1); | |
76 | + | |
77 | +// ... and send to browser | |
78 | +$graph->Stroke(); | |
79 | + | |
80 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,49 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +$datay=array(20,30,50,80); | |
6 | +$datay2=array(430,645,223,690); | |
7 | +$datazero=array(0,0,0,0); | |
8 | + | |
9 | +// Create the graph. | |
10 | +$graph = new Graph(450,200); | |
11 | +$graph->clearTheme(); | |
12 | +$graph->title->Set('Example with 2 scale bars'); | |
13 | + | |
14 | +// Setup Y and Y2 scales with some "grace" | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetY2Scale("lin"); | |
17 | +$graph->yaxis->scale->SetGrace(30); | |
18 | +$graph->y2axis->scale->SetGrace(30); | |
19 | + | |
20 | +//$graph->ygrid->Show(true,true); | |
21 | +$graph->ygrid->SetColor('gray','lightgray@0.5'); | |
22 | + | |
23 | +// Setup graph colors | |
24 | +$graph->SetMarginColor('white'); | |
25 | +$graph->y2axis->SetColor('darkred'); | |
26 | + | |
27 | + | |
28 | +// Create the "dummy" 0 bplot | |
29 | +$bplotzero = new BarPlot($datazero); | |
30 | + | |
31 | +// Create the "Y" axis group | |
32 | +$ybplot1 = new BarPlot($datay); | |
33 | +$ybplot1->value->Show(); | |
34 | +$ybplot = new GroupBarPlot(array($ybplot1,$bplotzero)); | |
35 | + | |
36 | +// Create the "Y2" axis group | |
37 | +$ybplot2 = new BarPlot($datay2); | |
38 | +$ybplot2->value->Show(); | |
39 | +$ybplot2->value->SetColor('darkred'); | |
40 | +$ybplot2->SetFillColor('darkred'); | |
41 | +$y2bplot = new GroupBarPlot(array($bplotzero,$ybplot2)); | |
42 | + | |
43 | +// Add the grouped bar plots to the graph | |
44 | +$graph->Add($ybplot); | |
45 | +$graph->AddY2($y2bplot); | |
46 | + | |
47 | +// .. and finally stroke the image back to browser | |
48 | +$graph->Stroke(); | |
49 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,52 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +$datay=array(12,26,9,17,31); | |
6 | + | |
7 | +// Create the graph. | |
8 | +// One minute timeout for the cached image | |
9 | +// INLINE_NO means don't stream it back to the browser. | |
10 | +$graph = new Graph(310,250,'auto'); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(60,30,20,40); | |
13 | +$graph->yaxis->SetTitleMargin(45); | |
14 | +$graph->yaxis->scale->SetGrace(30); | |
15 | +$graph->SetShadow(); | |
16 | + | |
17 | +// Turn the tickmarks | |
18 | +$graph->xaxis->SetTickSide(SIDE_DOWN); | |
19 | +$graph->yaxis->SetTickSide(SIDE_LEFT); | |
20 | + | |
21 | +// Create a bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | + | |
24 | +// Create targets for the image maps. One for each column | |
25 | +$targ=array("bar_clsmex1.php#1","bar_clsmex1.php#2","bar_clsmex1.php#3","bar_clsmex1.php#4","bar_clsmex1.php#5","bar_clsmex1.php#6"); | |
26 | +$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); | |
27 | +$bplot->SetCSIMTargets($targ,$alts); | |
28 | +$bplot->SetFillColor("orange"); | |
29 | + | |
30 | +// Use a shadow on the bar graphs (just use the default settings) | |
31 | +$bplot->SetShadow(); | |
32 | +$bplot->value->SetFormat(" $ %2.1f",70); | |
33 | +$bplot->value->SetFont(FF_ARIAL,FS_NORMAL,9); | |
34 | +$bplot->value->SetColor("blue"); | |
35 | +$bplot->value->Show(); | |
36 | + | |
37 | +$graph->Add($bplot); | |
38 | + | |
39 | +$graph->title->Set("Image maps barex1"); | |
40 | +$graph->xaxis->title->Set("X-title"); | |
41 | +$graph->yaxis->title->Set("Y-title"); | |
42 | + | |
43 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
44 | +$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
45 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
46 | + | |
47 | +// Send back the HTML page which will call this script again | |
48 | +// to retrieve the image. | |
49 | +$graph->StrokeCSIM(); | |
50 | + | |
51 | + | |
52 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,51 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +$data1y=array(12,8,19,3,10,5); | |
6 | +$data2y=array(8,2,12,7,14,4); | |
7 | + | |
8 | +// Create the graph. These two calls are always required | |
9 | +$graph = new Graph(310,200,'auto'); | |
10 | +$graph->SetScale("textlin"); | |
11 | +$graph->img->SetMargin(40,30,20,40); | |
12 | +$graph->SetShadow(); | |
13 | + | |
14 | +// Create the bar plots | |
15 | +$b1plot = new BarPlot($data1y); | |
16 | +$b1plot->SetFillColor("orange"); | |
17 | +$targ=array("bar_clsmex2.php#1","bar_clsmex2.php#2","bar_clsmex2.php#3", | |
18 | +"bar_clsmex2.php#4","bar_clsmex2.php#5","bar_clsmex2.php#6"); | |
19 | +$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); | |
20 | +$b1plot->SetCSIMTargets($targ,$alts); | |
21 | + | |
22 | +$b2plot = new BarPlot($data2y); | |
23 | +$b2plot->SetFillColor("blue"); | |
24 | +$targ=array("bar_clsmex2.php#7","bar_clsmex2.php#8","bar_clsmex2.php#9", | |
25 | +"bar_clsmex2.php#10","bar_clsmex2.php#11","bar_clsmex2.php#12"); | |
26 | +$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); | |
27 | +$b2plot->SetCSIMTargets($targ,$alts); | |
28 | + | |
29 | +// Create the grouped bar plot | |
30 | +$abplot = new AccBarPlot(array($b1plot,$b2plot)); | |
31 | + | |
32 | +$abplot->SetShadow(); | |
33 | +$abplot->value->Show(); | |
34 | + | |
35 | +// ...and add it to the graPH | |
36 | +$graph->Add($abplot); | |
37 | + | |
38 | +$graph->title->Set("Image map barex2"); | |
39 | +$graph->xaxis->title->Set("X-title"); | |
40 | +$graph->yaxis->title->Set("Y-title"); | |
41 | + | |
42 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
43 | +$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
44 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
45 | + | |
46 | + | |
47 | +// Send back the HTML page which will call this script again | |
48 | +// to retrieve the image. | |
49 | +$graph->StrokeCSIM(); | |
50 | + | |
51 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,88 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: bar_csimex3.php,v 1.3 2002/08/31 20:03:46 aditus Exp $ | |
3 | +// Horiontal bar graph with image maps | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_bar.php'); | |
6 | + | |
7 | +$data1y=array(5,8,19,3,10,5); | |
8 | +$data2y=array(12,2,12,7,14,4); | |
9 | + | |
10 | +// Setup the basic parameters for the graph | |
11 | +$graph = new Graph(400,700); | |
12 | +$graph->SetAngle(90); | |
13 | +$graph->SetScale("textlin"); | |
14 | + | |
15 | +// The negative margins are necessary since we | |
16 | +// have rotated the image 90 degress and shifted the | |
17 | +// meaning of width, and height. This means that the | |
18 | +// left and right margins now becomes top and bottom | |
19 | +// calculated with the image width and not the height. | |
20 | +$graph->img->SetMargin(-80,-80,210,210); | |
21 | + | |
22 | +$graph->SetMarginColor('white'); | |
23 | + | |
24 | +// Setup title for graph | |
25 | +$graph->title->Set('Horizontal bar graph'); | |
26 | +$graph->title->SetFont(FF_FONT2,FS_BOLD); | |
27 | +$graph->subtitle->Set("With image map\nNote: The URL just points back to this image"); | |
28 | + | |
29 | +// Setup X-axis. | |
30 | +$graph->xaxis->SetTitle("X-title",'center'); | |
31 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
32 | +$graph->xaxis->title->SetAngle(90); | |
33 | +$graph->xaxis->SetTitleMargin(30); | |
34 | +$graph->xaxis->SetLabelMargin(15); | |
35 | +$graph->xaxis->SetLabelAlign('right','center'); | |
36 | + | |
37 | +// Setup Y-axis | |
38 | + | |
39 | +// First we want it at the bottom, i.e. the 'max' value of the | |
40 | +// x-axis | |
41 | +$graph->yaxis->SetPos('max'); | |
42 | + | |
43 | +// Arrange the title | |
44 | +$graph->yaxis->SetTitle("Turnaround (mkr)",'center'); | |
45 | +$graph->yaxis->SetTitleSide(SIDE_RIGHT); | |
46 | +$graph->yaxis->title->SetFont(FF_FONT2,FS_BOLD); | |
47 | +$graph->yaxis->title->SetAngle(0); | |
48 | +$graph->yaxis->title->Align('center','top'); | |
49 | +$graph->yaxis->SetTitleMargin(30); | |
50 | + | |
51 | +// Arrange the labels | |
52 | +$graph->yaxis->SetLabelSide(SIDE_RIGHT); | |
53 | +$graph->yaxis->SetLabelAlign('center','top'); | |
54 | + | |
55 | +// Create the bar plots with image maps | |
56 | +$b1plot = new BarPlot($data1y); | |
57 | +$b1plot->SetFillColor("orange"); | |
58 | +$targ=array("bar_clsmex2.php#1","bar_clsmex2.php#2","bar_clsmex2.php#3", | |
59 | + "bar_clsmex2.php#4","bar_clsmex2.php#5","bar_clsmex2.php#6"); | |
60 | +$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); | |
61 | +$b1plot->SetCSIMTargets($targ,$alts); | |
62 | + | |
63 | +$b2plot = new BarPlot($data2y); | |
64 | +$b2plot->SetFillColor("blue"); | |
65 | +$targ=array("bar_clsmex2.php#7","bar_clsmex2.php#8","bar_clsmex2.php#9", | |
66 | + "bar_clsmex2.php#10","bar_clsmex2.php#11","bar_clsmex2.php#12"); | |
67 | +$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); | |
68 | +$b2plot->SetCSIMTargets($targ,$alts); | |
69 | + | |
70 | +// Create the accumulated bar plot | |
71 | +$abplot = new AccBarPlot(array($b1plot,$b2plot)); | |
72 | +$abplot->SetShadow(); | |
73 | + | |
74 | +// We want to display the value of each bar at the top | |
75 | +$abplot->value->Show(); | |
76 | +$abplot->value->SetFont(FF_FONT1,FS_NORMAL); | |
77 | +$abplot->value->SetAlign('left','center'); | |
78 | +$abplot->value->SetColor("black","darkred"); | |
79 | +$abplot->value->SetFormat('%.1f mkr'); | |
80 | + | |
81 | +// ...and add it to the graph | |
82 | +$graph->Add($abplot); | |
83 | + | |
84 | +// Send back the HTML page which will call this script again | |
85 | +// to retrieve the image. | |
86 | +$graph->StrokeCSIM(); | |
87 | + | |
88 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,16 @@ |
1 | +<?php | |
2 | +// ============================================== | |
3 | +// Output Image using Code 39 using only default values | |
4 | +// ============================================== | |
5 | +require_once ('jpgraph/jpgraph_barcode.php'); | |
6 | + | |
7 | +try { | |
8 | +$encoder = BarcodeFactory::Create(ENCODING_CODE39); | |
9 | +$e = BackendFactory::Create(BACKEND_IMAGE,$encoder); | |
10 | +$e->Stroke('abc123'); | |
11 | +} catch( JpGraphException $e ) { | |
12 | + //echo 'Error: ' . $e->getMessage()."\n"; | |
13 | + JpGraphError::Raise($e->getMessage()); | |
14 | +} | |
15 | + | |
16 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,11 @@ |
1 | +<?php | |
2 | +// ============================================== | |
3 | +// Output Image using Code 39 using only default values | |
4 | +// ============================================== | |
5 | +require_once ('jpgraph/jpgraph_barcode.php'); | |
6 | + | |
7 | +$encoder = BarcodeFactory::Create(ENCODING_CODE39); | |
8 | +$e = BackendFactory::Create(BACKEND_IMAGE,$encoder); | |
9 | +$e->Stroke('ABC123'); | |
10 | + | |
11 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,14 @@ |
1 | +<?php | |
2 | +// ============================================== | |
3 | +// Output Image using Code 128 | |
4 | +// ============================================== | |
5 | +require_once ('jpgraph/jpgraph_barcode.php'); | |
6 | + | |
7 | +$encoder = BarcodeFactory::Create(ENCODING_CODE128); | |
8 | +$e = BackendFactory::Create(BACKEND_PS,$encoder); | |
9 | +$e->SetModuleWidth(2); | |
10 | +$e->SetHeight(20); | |
11 | +echo nl2br($e->Stroke('3125134772')); | |
12 | + | |
13 | + | |
14 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,14 @@ |
1 | +<?php | |
2 | +// ============================================== | |
3 | +// Output Postscript of nterleaved 2 of 5 | |
4 | +// ============================================== | |
5 | +require_once ('jpgraph/jpgraph_barcode.php'); | |
6 | + | |
7 | +$encoder = BarcodeFactory::Create(ENCODING_CODEI25); | |
8 | +$e = BackendFactory::Create(BACKEND_PS,$encoder); | |
9 | +$e->SetModuleWidth(2); | |
10 | +$e->SetHeight(70); | |
11 | +$ps = $e->Stroke('3125134772'); | |
12 | +echo nl2br(htmlspecialchars($ps)); | |
13 | + | |
14 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +<?php | |
2 | +// ============================================== | |
3 | +// Output Encapsulated Postscript of interleaved 2 of 5 | |
4 | +// ============================================== | |
5 | +require_once ('jpgraph/jpgraph_barcode.php'); | |
6 | + | |
7 | +echo "Start ...<br>"; | |
8 | +$encoder = BarcodeFactory::Create(ENCODING_CODEI25); | |
9 | +$e = BackendFactory::Create(BACKEND_PS,$encoder); | |
10 | +$e->SetModuleWidth(2); | |
11 | +$e->SetHeight(70); | |
12 | +$e->SetEPS(); | |
13 | +$ps = $e->Stroke('3125134772'); | |
14 | +echo nl2br(htmlspecialchars($ps)); | |
15 | + | |
16 | + | |
17 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,12 @@ |
1 | +<?php | |
2 | +// ============================================== | |
3 | +// Output Image using Code Interleaved 2 of 5 | |
4 | +// ============================================== | |
5 | +require_once ('jpgraph/jpgraph_barcode.php'); | |
6 | + | |
7 | +$encoder = BarcodeFactory::Create(ENCODING_CODEI25); | |
8 | +$e = BackendFactory::Create(BACKEND_IMAGE,$encoder); | |
9 | +$e->SetModuleWidth(2); | |
10 | +$e->Stroke('1234'); | |
11 | + | |
12 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,74 @@ |
1 | +<?php | |
2 | +// ======================================================= | |
3 | +// Example of how to format US Postal shipping information | |
4 | +// ======================================================= | |
5 | +require_once ('jpgraph/jpgraph_barcode.php'); | |
6 | + | |
7 | +// The Full barcode standard is described in | |
8 | +// http://www.usps.com/cpim/ftp/pubs/pub91/91c4.html#508hdr1 | |
9 | +// | |
10 | +// The data start with AI=420 which means | |
11 | +// "Ship to/Deliver To Postal Code (within single authority) | |
12 | +// | |
13 | +class USPS_Confirmation { | |
14 | + function __construct() { | |
15 | + } | |
16 | + | |
17 | + // Private utility function | |
18 | + function _USPS_chkd($aData) { | |
19 | + $n = strlen($aData); | |
20 | + | |
21 | + // Add all even numbers starting from position 1 from the end | |
22 | + $et = 0 ; | |
23 | + for( $i=1; $i <= $n; $i+=2 ) { | |
24 | + $d = intval(substr($aData,-$i,1)); | |
25 | + $et += $d; | |
26 | + } | |
27 | + | |
28 | + // Add all odd numbers starting from position 2 from the end | |
29 | + $ot = 0 ; | |
30 | + for( $i=2; $i <= $n; $i+=2 ) { | |
31 | + $d = intval(substr($aData,-$i,1)); | |
32 | + $ot += $d; | |
33 | + } | |
34 | + $tot = 3*$et + $ot; | |
35 | + $chkdigit = (10 - ($tot % 10))%10;; | |
36 | + return $chkdigit; | |
37 | + } | |
38 | + | |
39 | + // Get type 1 of confirmation code (with ZIP) | |
40 | + function GetPICwithZIP($aZIP,$aServiceType,$aDUNS,$aSeqNbr) { | |
41 | + // Convert to USPS format with AI=420 and extension starting with AI=91 | |
42 | + $data = '420'. $aZIP . '91' . $aServiceType . $aDUNS . $aSeqNbr; | |
43 | + // Only calculate the checkdigit from the AI=91 and forward | |
44 | + // and do not include the ~1 (FUNC1) in the calculation | |
45 | + $cd = $this->_USPS_chkd(substr($data,8)); | |
46 | + $data = '420'. $aZIP . '~191' . $aServiceType . $aDUNS . $aSeqNbr; | |
47 | + return $data . $cd; | |
48 | + } | |
49 | + | |
50 | + // Get type 2 of confirmation code (without ZIP) | |
51 | + function GetPIC($aServiceType,$aDUNS,$aSeqNbr) { | |
52 | + // Convert to USPS format with AI=91 | |
53 | + $data = '91' . $aServiceType . $aDUNS . $aSeqNbr; | |
54 | + $cd = $this->_USPS_chkd($data); | |
55 | + return $data . $cd; | |
56 | + } | |
57 | + | |
58 | +} | |
59 | + | |
60 | +$usps = new USPS_Confirmation(); | |
61 | +$zip = '92663'; | |
62 | +$service = '21'; | |
63 | +$DUNS = '805213907'; | |
64 | +$seqnr = '04508735'; | |
65 | +$data = $usps->GetPICwithZIP($zip,$service,$DUNS,$seqnr); | |
66 | +//$data = $usps->GetPIC('01','123456789','00000001'); | |
67 | + | |
68 | +$encoder = BarcodeFactory::Create(ENCODING_EAN128); | |
69 | +$e = BackendFactory::Create(BACKEND_IMAGE,$encoder); | |
70 | +$e->SetModuleWidth(2); | |
71 | +$e->SetFont(FF_ARIAL,FS_NORMAL,14); | |
72 | +$e->Stroke($data); | |
73 | + | |
74 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,41 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Some random data to plot | |
6 | +$datay=array(12,26,9,17,31); | |
7 | + | |
8 | +// Create the graph. | |
9 | +$graph = new Graph(400,250); | |
10 | +$graph->SetScale("textlin"); | |
11 | + | |
12 | +// Create a bar pot | |
13 | +$bplot = new BarPlot($datay); | |
14 | + | |
15 | +// Create targets for the image maps so that the details are opened in a separate window | |
16 | +$fmtStr = "javascript:window.open('barcsim_details.php?id=%d','_new','width=500,height=300');void(0)"; | |
17 | +$n = count($datay); | |
18 | +$targ=array(); | |
19 | +$alts=array(); | |
20 | +for($i=0; $i < $n; ++$i) { | |
21 | + $targ[$i] = sprintf($fmtStr,$i+1); | |
22 | + $alts[$i] = 'val=%d'; | |
23 | + // Note: The format placeholder val=%d will be replaced by the actual value in the ouput HTML by the | |
24 | + // library so that when the user hoovers the mouse over the bar the actual numerical value of the bar | |
25 | + // will be dísplayed | |
26 | +} | |
27 | +$bplot->SetCSIMTargets($targ,$alts); | |
28 | + | |
29 | +// Add plot to graph | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Setup the title, also wih a CSIM area | |
33 | +$graph->title->Set("CSIM with popup windows"); | |
34 | +$graph->title->SetFont(FF_FONT2,FS_BOLD); | |
35 | +// Assume we can give more details on the graph | |
36 | +$graph->title->SetCSIMTarget(sprintf($fmtStr,-1),'Title for Bar'); | |
37 | + | |
38 | +// Send back the HTML page which will call this script again to retrieve the image. | |
39 | +$graph->StrokeCSIM(); | |
40 | + | |
41 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +$data = array(0.1235,0.4567,0.67,0.45,0.832); | |
6 | + | |
7 | +// Callback function | |
8 | +// Get called with the actual value and should return the | |
9 | +// value to be displayed as a string | |
10 | +function cbFmtPercentage($aVal) { | |
11 | + return sprintf("%.1f%%",100*$aVal); // Convert to string | |
12 | +} | |
13 | + | |
14 | +// Create the graph. | |
15 | +$graph = new Graph(400,300); | |
16 | +$graph->SetScale("textlin"); | |
17 | + | |
18 | +// Create a bar plots | |
19 | +$bar1 = new BarPlot($data); | |
20 | + | |
21 | +// Setup the callback function | |
22 | +$bar1->value->SetFormatCallback("cbFmtPercentage"); | |
23 | +$bar1->value->Show(); | |
24 | + | |
25 | +// Add the plot to the graph | |
26 | +$graph->Add($bar1); | |
27 | + | |
28 | +// .. and send the graph back to the browser | |
29 | +$graph->Stroke(); | |
30 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,48 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example for use of JpGraph, | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(0.13,0.25,0.21,0.35,0.31,0.06); | |
8 | +$datax=array("January","February","March","April","May","June"); | |
9 | + | |
10 | +// Setup the graph. | |
11 | +$graph = new Graph(400,240); | |
12 | +$graph->clearTheme(); | |
13 | +$graph->img->SetMargin(60,20,35,75); | |
14 | +$graph->SetScale("textlin"); | |
15 | +$graph->SetMarginColor("lightblue:1.1"); | |
16 | +$graph->SetShadow(); | |
17 | + | |
18 | +// Set up the title for the graph | |
19 | +$graph->title->Set("Bar gradient with left reflection"); | |
20 | +$graph->title->SetMargin(8); | |
21 | +$graph->title->SetFont(FF_VERDANA,FS_BOLD,12); | |
22 | +$graph->title->SetColor("darkred"); | |
23 | + | |
24 | +// Setup font for axis | |
25 | +$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
26 | +$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
27 | + | |
28 | +// Show 0 label on Y-axis (default is not to show) | |
29 | +$graph->yscale->ticks->SupressZeroLabel(false); | |
30 | + | |
31 | +// Setup X-axis labels | |
32 | +$graph->xaxis->SetTickLabels($datax); | |
33 | +$graph->xaxis->SetLabelAngle(50); | |
34 | + | |
35 | +// Create the bar pot | |
36 | +$bplot = new BarPlot($datay); | |
37 | +$bplot->SetWidth(0.6); | |
38 | + | |
39 | +// Setup color for gradient fill style | |
40 | +$bplot->SetFillGradient("navy:0.9","navy:1.85",GRAD_LEFT_REFLECTION); | |
41 | + | |
42 | +// Set color for the frame of each bar | |
43 | +$bplot->SetColor("white"); | |
44 | +$graph->Add($bplot); | |
45 | + | |
46 | +// Finally send the graph to the browser | |
47 | +$graph->Stroke(); | |
48 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,49 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example for use of JpGraph, | |
3 | +// ljp, 01/03/01 20:32 | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_bar.php'); | |
6 | + | |
7 | +// We need some data | |
8 | +$datay=array(-0.13,0.25,-0.21,0.35,0.31,0.04); | |
9 | +$datax=array("Jan","Feb","Mar","Apr","May","June"); | |
10 | + | |
11 | +// Setup the graph. | |
12 | +$graph = new Graph(400,200); | |
13 | +$graph->clearTheme(); | |
14 | +$graph->img->SetMargin(60,20,30,50); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMarginColor("silver"); | |
17 | +$graph->SetShadow(); | |
18 | + | |
19 | +// Set up the title for the graph | |
20 | +$graph->title->Set("Example negative bars"); | |
21 | +$graph->title->SetFont(FF_VERDANA,FS_NORMAL,18); | |
22 | +$graph->title->SetColor("darkred"); | |
23 | + | |
24 | +// Setup font for axis | |
25 | +$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,12); | |
26 | +$graph->xaxis->SetColor("black","red"); | |
27 | +$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,11); | |
28 | + | |
29 | +// Show 0 label on Y-axis (default is not to show) | |
30 | +$graph->yscale->ticks->SupressZeroLabel(false); | |
31 | + | |
32 | +// Setup X-axis labels | |
33 | +$graph->xaxis->SetTickLabels($datax); | |
34 | +$graph->xaxis->SetLabelAngle(50); | |
35 | + | |
36 | +// Create the bar pot | |
37 | +$bplot = new BarPlot($datay); | |
38 | +$bplot->SetWidth(0.6); | |
39 | + | |
40 | +// Setup color for gradient fill style | |
41 | +$bplot->SetFillGradient("navy","steelblue",GRAD_MIDVER); | |
42 | + | |
43 | +// Set color for the frame of each bar | |
44 | +$bplot->SetColor("navy"); | |
45 | +$graph->Add($bplot); | |
46 | + | |
47 | +// Finally send the graph to the browser | |
48 | +$graph->Stroke(); | |
49 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,51 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example for use of JpGraph, | |
3 | +// ljp, 01/03/01 20:32 | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_bar.php'); | |
6 | + | |
7 | +// We need some data | |
8 | +$datay=array(-0.13,0.25,-0.21,0.35,0.31,0.04); | |
9 | +$datax=array("Jan","Feb","Mar","Apr","May","June"); | |
10 | + | |
11 | +// Setup the graph. | |
12 | +$graph = new Graph(400,200); | |
13 | +$graph->clearTheme(); | |
14 | +$graph->img->SetMargin(60,20,30,50); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMarginColor("silver"); | |
17 | +$graph->SetShadow(); | |
18 | + | |
19 | +// Set up the title for the graph | |
20 | +$graph->title->Set("Example negative bars"); | |
21 | +$graph->title->SetFont(FF_VERDANA,FS_NORMAL,16); | |
22 | +$graph->title->SetColor("darkred"); | |
23 | + | |
24 | +// Setup font for axis | |
25 | +$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
26 | +$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
27 | + | |
28 | +// Show 0 label on Y-axis (default is not to show) | |
29 | +$graph->yscale->ticks->SupressZeroLabel(false); | |
30 | + | |
31 | +// Setup X-axis labels | |
32 | +$graph->xaxis->SetTickLabels($datax); | |
33 | +$graph->xaxis->SetLabelAngle(50); | |
34 | + | |
35 | +// Set X-axis at the minimum value of Y-axis (default will be at 0) | |
36 | +$graph->xaxis->SetPos("min"); // "min" will position the x-axis at the minimum value of the Y-axis | |
37 | + | |
38 | +// Create the bar pot | |
39 | +$bplot = new BarPlot($datay); | |
40 | +$bplot->SetWidth(0.6); | |
41 | + | |
42 | +// Setup color for gradient fill style | |
43 | +$bplot->SetFillGradient("navy","steelblue",GRAD_MIDVER); | |
44 | + | |
45 | +// Set color for the frame of each bar | |
46 | +$bplot->SetColor("navy"); | |
47 | +$graph->Add($bplot); | |
48 | + | |
49 | +// Finally send the graph to the browser | |
50 | +$graph->Stroke(); | |
51 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,48 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example for use of JpGraph, | |
3 | +// ljp, 01/03/01 19:44 | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_bar.php'); | |
6 | + | |
7 | +// We need some data | |
8 | +$datay=array(0.3031,0.3044,0.3049,0.3040,0.3024,0.3047); | |
9 | + | |
10 | +// Setup the graph. | |
11 | +$graph = new Graph(400,200); | |
12 | +$graph->clearTheme(); | |
13 | +$graph->img->SetMargin(60,30,30,40); | |
14 | +$graph->SetScale("textlin"); | |
15 | +$graph->SetMarginColor("teal"); | |
16 | +$graph->SetShadow(); | |
17 | + | |
18 | +// Set up the title for the graph | |
19 | +$graph->title->Set("Bargraph with small variations"); | |
20 | +$graph->title->SetColor("white"); | |
21 | +$graph->title->SetFont(FF_VERDANA,FS_BOLD,12); | |
22 | + | |
23 | +// Setup color for axis and labels | |
24 | +$graph->xaxis->SetColor("black","white"); | |
25 | +$graph->yaxis->SetColor("black","white"); | |
26 | + | |
27 | +// Setup font for axis | |
28 | +$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
29 | +$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
30 | + | |
31 | +// Setup X-axis title (color & font) | |
32 | +$graph->xaxis->title->Set("X-axis"); | |
33 | +$graph->xaxis->title->SetColor("white"); | |
34 | +$graph->xaxis->title->SetFont(FF_VERDANA,FS_BOLD,10); | |
35 | + | |
36 | +// Create the bar pot | |
37 | +$bplot = new BarPlot($datay); | |
38 | +$bplot->SetWidth(0.6); | |
39 | + | |
40 | +// Setup color for gradient fill style | |
41 | +$tcol=array(100,100,255); | |
42 | +$fcol=array(255,100,100); | |
43 | +$bplot->SetFillGradient($fcol,$tcol,GRAD_HOR); | |
44 | +$graph->Add($bplot); | |
45 | + | |
46 | +// Finally send the graph to the browser | |
47 | +$graph->Stroke(); | |
48 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,53 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example for use of JpGraph, | |
3 | +// ljp, 01/03/01 19:44 | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_bar.php'); | |
6 | +require_once ('jpgraph/jpgraph_line.php'); | |
7 | + | |
8 | +// We need some data | |
9 | +$datay=array(0.3031,0.3044,0.3049,0.3040,0.3024,0.3047); | |
10 | + | |
11 | +// Setup the graph. | |
12 | +$graph = new Graph(400,200); | |
13 | +$graph->clearTheme(); | |
14 | +$graph->img->SetMargin(60,30,30,40); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMarginColor("teal"); | |
17 | +$graph->SetShadow(); | |
18 | + | |
19 | +// Create the bar pot | |
20 | +$bplot = new BarPlot($datay); | |
21 | +$bplot->SetWidth(0.6); | |
22 | + | |
23 | +// This is how you make the bar graph start from something other than 0 | |
24 | +$bplot->SetYMin(0.302); | |
25 | + | |
26 | +// Setup color for gradient fill style | |
27 | +$tcol=array(100,100,255); | |
28 | +$fcol=array(255,100,100); | |
29 | +$bplot->SetFillGradient($fcol,$tcol,GRAD_HOR); | |
30 | +$bplot->SetFillColor("orange"); | |
31 | +$graph->Add($bplot); | |
32 | + | |
33 | +// Set up the title for the graph | |
34 | +$graph->title->Set("Bargraph which doesn't start from y=0"); | |
35 | +$graph->title->SetColor("yellow"); | |
36 | +$graph->title->SetFont(FF_VERDANA,FS_BOLD,12); | |
37 | + | |
38 | +// Setup color for axis and labels | |
39 | +$graph->xaxis->SetColor("black","white"); | |
40 | +$graph->yaxis->SetColor("black","white"); | |
41 | + | |
42 | +// Setup font for axis | |
43 | +$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
44 | +$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
45 | + | |
46 | +// Setup X-axis title (color & font) | |
47 | +$graph->xaxis->title->Set("X-axis"); | |
48 | +$graph->xaxis->title->SetColor("white"); | |
49 | +$graph->xaxis->title->SetFont(FF_VERDANA,FS_BOLD,10); | |
50 | + | |
51 | +// Finally send the graph to the browser | |
52 | +$graph->Stroke(); | |
53 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,52 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example for use of JpGraph, | |
3 | +// ljp, 01/03/01 20:32 | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_bar.php'); | |
6 | + | |
7 | +// We need some data | |
8 | +$datay=array(-0.13,0.25,-0.21,0.35,0.31,0.04); | |
9 | +$datax=array("Jan","Feb","Mar","Apr","May","June"); | |
10 | + | |
11 | +// Setup the graph. | |
12 | +$graph = new Graph(500,200); | |
13 | +$graph->clearTheme(); | |
14 | +$graph->img->SetMargin(60,150,30,50); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMarginColor("silver"); | |
17 | +$graph->SetShadow(); | |
18 | + | |
19 | +// Set up the title for the graph | |
20 | +$graph->title->Set("Example negative bars"); | |
21 | +$graph->title->SetFont(FF_VERDANA,FS_NORMAL,16); | |
22 | +$graph->title->SetColor("darkred"); | |
23 | + | |
24 | +// Setup font for axis | |
25 | +$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
26 | +$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10); | |
27 | + | |
28 | +// Show 0 label on Y-axis (default is not to show) | |
29 | +$graph->yscale->ticks->SupressZeroLabel(false); | |
30 | + | |
31 | +// Setup X-axis labels | |
32 | +$graph->xaxis->SetTickLabels($datax); | |
33 | +$graph->xaxis->SetLabelAngle(50); | |
34 | + | |
35 | +// Set X-axis at the minimum value of Y-axis (default will be at 0) | |
36 | +$graph->xaxis->SetPos("min"); // "min" will position the x-axis at the minimum value of the Y-axis | |
37 | + | |
38 | +// Create the bar pot | |
39 | +$bplot = new BarPlot($datay); | |
40 | +$bplot->SetWidth(0.6); | |
41 | +$bplot->SetLegend("Result 1999","blue"); | |
42 | + | |
43 | +// Setup color for gradient fill style | |
44 | +$bplot->SetFillGradient("navy","steelblue",GRAD_MIDVER); | |
45 | + | |
46 | +// Set color for the frame of each bar | |
47 | +$bplot->SetColor("navy"); | |
48 | +$graph->Add($bplot); | |
49 | + | |
50 | +// Finally send the graph to the browser | |
51 | +$graph->Stroke(); | |
52 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(4,8,6); | |
8 | + | |
9 | +// Setup the graph. | |
10 | +$graph = new Graph(200,150); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(25,15,25,25); | |
13 | + | |
14 | +$graph->title->Set('"GRAD_MIDVER"'); | |
15 | +$graph->title->SetColor('darkred'); | |
16 | + | |
17 | +// Setup font for axis | |
18 | +$graph->xaxis->SetFont(FF_FONT1); | |
19 | +$graph->yaxis->SetFont(FF_FONT1); | |
20 | + | |
21 | +// Create the bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | +$bplot->SetWidth(0.6); | |
24 | + | |
25 | +// Setup color for gradient fill style | |
26 | +$bplot->SetFillGradient("navy","lightsteelblue",GRAD_MIDVER); | |
27 | + | |
28 | +// Set color for the frame of each bar | |
29 | +$bplot->SetColor("navy"); | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Finally send the graph to the browser | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(4,8,6); | |
8 | + | |
9 | +// Setup the graph. | |
10 | +$graph = new Graph(200,150); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(25,15,25,25); | |
13 | + | |
14 | +$graph->title->Set('"GRAD_MIDHOR"'); | |
15 | +$graph->title->SetColor('darkred'); | |
16 | + | |
17 | +// Setup font for axis | |
18 | +$graph->xaxis->SetFont(FF_FONT1); | |
19 | +$graph->yaxis->SetFont(FF_FONT1); | |
20 | + | |
21 | +// Create the bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | +$bplot->SetWidth(0.6); | |
24 | + | |
25 | +// Setup color for gradient fill style | |
26 | +$bplot->SetFillGradient("navy","lightsteelblue",GRAD_MIDHOR); | |
27 | + | |
28 | +// Set color for the frame of each bar | |
29 | +$bplot->SetColor("navy"); | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Finally send the graph to the browser | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(4,8,6); | |
8 | + | |
9 | +// Setup the graph. | |
10 | +$graph = new Graph(200,150); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(25,15,25,25); | |
13 | + | |
14 | +$graph->title->Set('"GRAD_HOR"'); | |
15 | +$graph->title->SetColor('darkred'); | |
16 | + | |
17 | +// Setup font for axis | |
18 | +$graph->xaxis->SetFont(FF_FONT1); | |
19 | +$graph->yaxis->SetFont(FF_FONT1); | |
20 | + | |
21 | +// Create the bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | +$bplot->SetWidth(0.6); | |
24 | + | |
25 | +// Setup color for gradient fill style | |
26 | +$bplot->SetFillGradient("navy","lightsteelblue",GRAD_HOR); | |
27 | + | |
28 | +// Set color for the frame of each bar | |
29 | +$bplot->SetColor("navy"); | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Finally send the graph to the browser | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(4,8,6); | |
8 | + | |
9 | +// Setup the graph. | |
10 | +$graph = new Graph(200,150); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(25,15,25,25); | |
13 | + | |
14 | +$graph->title->Set('"GRAD_VER"'); | |
15 | +$graph->title->SetColor('darkred'); | |
16 | + | |
17 | +// Setup font for axis | |
18 | +$graph->xaxis->SetFont(FF_FONT1); | |
19 | +$graph->yaxis->SetFont(FF_FONT1); | |
20 | + | |
21 | +// Create the bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | +$bplot->SetWidth(0.6); | |
24 | + | |
25 | +// Setup color for gradient fill style | |
26 | +$bplot->SetFillGradient("navy","lightsteelblue",GRAD_VER); | |
27 | + | |
28 | +// Set color for the frame of each bar | |
29 | +$bplot->SetColor("navy"); | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Finally send the graph to the browser | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(4,8,6); | |
8 | + | |
9 | +// Setup the graph. | |
10 | +$graph = new Graph(200,150); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(25,15,25,25); | |
13 | + | |
14 | +$graph->title->Set('"GRAD_WIDE_MIDVER"'); | |
15 | +$graph->title->SetColor('darkred'); | |
16 | + | |
17 | +// Setup font for axis | |
18 | +$graph->xaxis->SetFont(FF_FONT1); | |
19 | +$graph->yaxis->SetFont(FF_FONT1); | |
20 | + | |
21 | +// Create the bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | +$bplot->SetWidth(0.6); | |
24 | + | |
25 | +// Setup color for gradient fill style | |
26 | +$bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDVER); | |
27 | + | |
28 | +// Set color for the frame of each bar | |
29 | +$bplot->SetColor("navy"); | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Finally send the graph to the browser | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(4,8,6); | |
8 | + | |
9 | +// Setup the graph. | |
10 | +$graph = new Graph(200,150); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(25,15,25,25); | |
13 | + | |
14 | +$graph->title->Set('"GRAD_WIDE_MIDHOR"'); | |
15 | +$graph->title->SetColor('darkred'); | |
16 | + | |
17 | +// Setup font for axis | |
18 | +$graph->xaxis->SetFont(FF_FONT1); | |
19 | +$graph->yaxis->SetFont(FF_FONT1); | |
20 | + | |
21 | +// Create the bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | +$bplot->SetWidth(0.6); | |
24 | + | |
25 | +// Setup color for gradient fill style | |
26 | +$bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDHOR); | |
27 | + | |
28 | +// Set color for the frame of each bar | |
29 | +$bplot->SetColor("navy"); | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Finally send the graph to the browser | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(4,8,6); | |
8 | + | |
9 | +// Setup the graph. | |
10 | +$graph = new Graph(200,150); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(25,15,25,25); | |
13 | + | |
14 | +$graph->title->Set('"GRAD_CENTER"'); | |
15 | +$graph->title->SetColor('darkred'); | |
16 | + | |
17 | +// Setup font for axis | |
18 | +$graph->xaxis->SetFont(FF_FONT1); | |
19 | +$graph->yaxis->SetFont(FF_FONT1); | |
20 | + | |
21 | +// Create the bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | +$bplot->SetWidth(0.6); | |
24 | + | |
25 | +// Setup color for gradient fill style | |
26 | +$bplot->SetFillGradient("navy","lightsteelblue",GRAD_CENTER); | |
27 | + | |
28 | +// Set color for the frame of each bar | |
29 | +$bplot->SetColor("navy"); | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Finally send the graph to the browser | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// We need some data | |
7 | +$datay=array(4,8,6); | |
8 | + | |
9 | +// Setup the graph. | |
10 | +$graph = new Graph(200,150); | |
11 | +$graph->SetScale("textlin"); | |
12 | +$graph->img->SetMargin(25,15,25,25); | |
13 | + | |
14 | +$graph->title->Set('"GRAD_RAISED_PANEL"'); | |
15 | +$graph->title->SetColor('darkred'); | |
16 | + | |
17 | +// Setup font for axis | |
18 | +$graph->xaxis->SetFont(FF_FONT1); | |
19 | +$graph->yaxis->SetFont(FF_FONT1); | |
20 | + | |
21 | +// Create the bar pot | |
22 | +$bplot = new BarPlot($datay); | |
23 | +$bplot->SetWidth(0.6); | |
24 | + | |
25 | +// Setup color for gradient fill style | |
26 | +$bplot->SetFillGradient('navy','orange',GRAD_RAISED_PANEL); | |
27 | + | |
28 | +// Set color for the frame of each bar | |
29 | +$bplot->SetColor("navy"); | |
30 | +$graph->Add($bplot); | |
31 | + | |
32 | +// Finally send the graph to the browser | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | +require_once ('jpgraph/jpgraph_line.php'); | |
5 | + | |
6 | +$datay=array(5,3,11,6,3); | |
7 | + | |
8 | +$graph = new Graph(400,300,'auto'); | |
9 | +$graph->clearTheme(); | |
10 | +$graph->SetScale("textlin"); | |
11 | + | |
12 | +$graph->title->Set('Images on top of bars'); | |
13 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,13); | |
14 | + | |
15 | +$graph->SetTitleBackground('lightblue:1.1',TITLEBKG_STYLE1,TITLEBKG_FRAME_BEVEL); | |
16 | + | |
17 | +$bplot = new BarPlot($datay); | |
18 | +$bplot->SetFillColor("orange"); | |
19 | +$bplot->SetWidth(0.5); | |
20 | + | |
21 | +$lplot = new LinePlot($datay); | |
22 | +$lplot->SetColor('white@1'); | |
23 | +$lplot->SetBarCenter(); | |
24 | +$lplot->mark->SetType(MARK_IMG_LBALL,'red'); | |
25 | + | |
26 | +$graph->Add($bplot); | |
27 | +$graph->Add($lplot); | |
28 | + | |
29 | +$graph->Stroke(); | |
30 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,49 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: barintex1.php,v 1.3 2002/07/11 23:27:28 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +// Some data | |
7 | +$datay=array(1,1,0.5); | |
8 | + | |
9 | +// Create the graph and setup the basic parameters | |
10 | +$graph = new Graph(460,200,'auto'); | |
11 | +$graph->clearTheme(); | |
12 | +$graph->img->SetMargin(40,30,30,40); | |
13 | +$graph->SetScale("textint"); | |
14 | +$graph->SetShadow(); | |
15 | +$graph->SetFrame(false); // No border around the graph | |
16 | + | |
17 | +// Add some grace to the top so that the scale doesn't | |
18 | +// end exactly at the max value. | |
19 | +$graph->yaxis->scale->SetGrace(100); | |
20 | + | |
21 | +// Setup X-axis labels | |
22 | +$a = $gDateLocale->GetShortMonth(); | |
23 | +$graph->xaxis->SetTickLabels($a); | |
24 | +$graph->xaxis->SetFont(FF_FONT2); | |
25 | + | |
26 | +// Setup graph title ands fonts | |
27 | +$graph->title->Set("Example of integer Y-scale"); | |
28 | +$graph->title->SetFont(FF_FONT2,FS_BOLD); | |
29 | +$graph->xaxis->title->Set("Year 2002"); | |
30 | +$graph->xaxis->title->SetFont(FF_FONT2,FS_BOLD); | |
31 | + | |
32 | +// Create a bar pot | |
33 | +$bplot = new BarPlot($datay); | |
34 | +$bplot->SetFillColor("orange"); | |
35 | +$bplot->SetWidth(0.5); | |
36 | +$bplot->SetShadow(); | |
37 | + | |
38 | +// Setup the values that are displayed on top of each bar | |
39 | +$bplot->value->Show(); | |
40 | +// Must use TTF fonts if we want text at an arbitrary angle | |
41 | +$bplot->value->SetFont(FF_ARIAL,FS_BOLD); | |
42 | +$bplot->value->SetAngle(45); | |
43 | +// Black color for positive values and darkred for negative values | |
44 | +$bplot->value->SetColor("black","darkred"); | |
45 | +$graph->Add($bplot); | |
46 | + | |
47 | +// Finally stroke the graph | |
48 | +$graph->Stroke(); | |
49 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$datay=array(3,7,19,11,4,20); | |
7 | + | |
8 | +// Create the graph and setup the basic parameters | |
9 | +$graph = new Graph(350,200,'auto'); | |
10 | +$graph->clearTheme(); | |
11 | +$graph->img->SetMargin(40,30,40,40); | |
12 | +$graph->SetScale("textint"); | |
13 | +$graph->SetFrame(true,'blue',1); | |
14 | +$graph->SetColor('lightblue'); | |
15 | +$graph->SetMarginColor('lightblue'); | |
16 | + | |
17 | +// Add some grace to the top so that the scale doesn't | |
18 | +// end exactly at the max value. | |
19 | +//$graph->yaxis->scale->SetGrace(20); | |
20 | + | |
21 | +// Setup X-axis labels | |
22 | +$a = $gDateLocale->GetShortMonth(); | |
23 | +$graph->xaxis->SetTickLabels($a); | |
24 | +$graph->xaxis->SetFont(FF_FONT1); | |
25 | +$graph->xaxis->SetColor('darkblue','black'); | |
26 | + | |
27 | +// Stup "hidden" y-axis by given it the same color | |
28 | +// as the background | |
29 | +$graph->yaxis->SetColor('lightblue','darkblue'); | |
30 | +$graph->ygrid->SetColor('white'); | |
31 | + | |
32 | +// Setup graph title ands fonts | |
33 | +$graph->title->Set('Example of integer Y-scale'); | |
34 | +$graph->subtitle->Set('(With "hidden" y-axis)'); | |
35 | + | |
36 | +$graph->title->SetFont(FF_FONT2,FS_BOLD); | |
37 | +$graph->xaxis->title->Set("Year 2002"); | |
38 | +$graph->xaxis->title->SetFont(FF_FONT2,FS_BOLD); | |
39 | + | |
40 | +// Create a bar pot | |
41 | +$bplot = new BarPlot($datay); | |
42 | +$bplot->SetFillColor('darkblue'); | |
43 | +$bplot->SetColor('darkblue'); | |
44 | +$bplot->SetWidth(0.5); | |
45 | +$bplot->SetShadow('darkgray'); | |
46 | + | |
47 | +// Setup the values that are displayed on top of each bar | |
48 | +$bplot->value->Show(); | |
49 | +// Must use TTF fonts if we want text at an arbitrary angle | |
50 | +$bplot->value->SetFont(FF_ARIAL,FS_NORMAL,8); | |
51 | +$bplot->value->SetFormat('$%d'); | |
52 | +// Black color for positive values and darkred for negative values | |
53 | +$bplot->value->SetColor("black","darkred"); | |
54 | +$graph->Add($bplot); | |
55 | + | |
56 | +// Finally stroke the graph | |
57 | +$graph->Stroke(); | |
58 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,42 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | + | |
6 | +$ydata = array(2,3,4,5,6,7,8,9,10,11); | |
7 | +$ydata2 = array(1,2,3,4,5,6,7,8,9,10); | |
8 | +$targ = array("#1","#2","#3","#4","#5","#6","#7","#8","#9","#10"); | |
9 | +$alt = array(1,2,3,4,5,6,7,8,9,10); | |
10 | + | |
11 | +// Create the graph. | |
12 | +$graph = new Graph(300,200); | |
13 | +$graph->SetScale("textlin"); | |
14 | +$graph->img->SetMargin(40,20,30,40); | |
15 | +$graph->title->Set("CSIM example with bar and line"); | |
16 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
17 | + | |
18 | +// Setup axis titles | |
19 | +$graph->xaxis->title->Set("X-title"); | |
20 | +$graph->yaxis->title->Set("Y-title"); | |
21 | + | |
22 | +// Create the linear plot | |
23 | +$lineplot=new LinePlot($ydata); | |
24 | +$lineplot->mark->SetType(MARK_FILLEDCIRCLE); | |
25 | +$lineplot->mark->SetWidth(5); | |
26 | +$lineplot->mark->SetColor('black'); | |
27 | +$lineplot->mark->SetFillColor('red'); | |
28 | +$lineplot->SetCSIMTargets($targ,$alt); | |
29 | + | |
30 | +// Create line plot | |
31 | +$barplot=new barPlot($ydata2); | |
32 | +$barplot->SetCSIMTargets($targ,$alt); | |
33 | + | |
34 | +// Add the plots to the graph | |
35 | +$graph->Add($lineplot); | |
36 | +$graph->Add($barplot); | |
37 | + | |
38 | +$graph->StrokeCSIM(); | |
39 | + | |
40 | +?> | |
41 | + | |
42 | + | |
... | ... |
... | ... | @@ -0,0 +1,74 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | +require_once ('jpgraph/jpgraph_line.php'); | |
5 | + | |
6 | +// Some "random" data | |
7 | +$ydata = array(10,120,80,190,260,170,60,40,20,230); | |
8 | +$ydata2 = array(10,70,40,120,200,60,80,40,20,5); | |
9 | + | |
10 | +// Get a list of month using the current locale | |
11 | +$months = $gDateLocale->GetShortMonth(); | |
12 | + | |
13 | +// Create the graph. | |
14 | +$graph = new Graph(300,200); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMarginColor('white'); | |
17 | + | |
18 | +// Adjust the margin slightly so that we use the | |
19 | +// entire area (since we don't use a frame) | |
20 | +$graph->SetMargin(30,1,20,5); | |
21 | + | |
22 | +// Box around plotarea | |
23 | +$graph->SetBox(); | |
24 | + | |
25 | +// No frame around the image | |
26 | +$graph->SetFrame(false); | |
27 | + | |
28 | +// Setup the tab title | |
29 | +$graph->tabtitle->Set('Year 2003'); | |
30 | +$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,10); | |
31 | + | |
32 | +// Setup the X and Y grid | |
33 | +$graph->ygrid->SetFill(true,'#DDDDDD@0.5','#BBBBBB@0.5'); | |
34 | +$graph->ygrid->SetLineStyle('dashed'); | |
35 | +$graph->ygrid->SetColor('gray'); | |
36 | +$graph->xgrid->Show(); | |
37 | +$graph->xgrid->SetLineStyle('dashed'); | |
38 | +$graph->xgrid->SetColor('gray'); | |
39 | + | |
40 | +// Setup month as labels on the X-axis | |
41 | +$graph->xaxis->SetTickLabels($months); | |
42 | +$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8); | |
43 | +$graph->xaxis->SetLabelAngle(45); | |
44 | + | |
45 | +// Create a bar pot | |
46 | +$bplot = new BarPlot($ydata); | |
47 | +$bplot->SetWidth(0.6); | |
48 | +$fcol='#440000'; | |
49 | +$tcol='#FF9090'; | |
50 | + | |
51 | +$bplot->SetFillGradient($fcol,$tcol,GRAD_LEFT_REFLECTION); | |
52 | + | |
53 | +// Set line weigth to 0 so that there are no border | |
54 | +// around each bar | |
55 | +$bplot->SetWeight(0); | |
56 | + | |
57 | +$graph->Add($bplot); | |
58 | + | |
59 | +// Create filled line plot | |
60 | +$lplot = new LinePlot($ydata2); | |
61 | +$lplot->SetFillColor('skyblue@0.5'); | |
62 | +$lplot->SetColor('navy@0.7'); | |
63 | +$lplot->SetBarCenter(); | |
64 | + | |
65 | +$lplot->mark->SetType(MARK_SQUARE); | |
66 | +$lplot->mark->SetColor('blue@0.5'); | |
67 | +$lplot->mark->SetFillColor('lightblue'); | |
68 | +$lplot->mark->SetSize(6); | |
69 | + | |
70 | +$graph->Add($lplot); | |
71 | + | |
72 | +// .. and finally send it back to the browser | |
73 | +$graph->Stroke(); | |
74 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,100 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// | |
3 | +// Example of CSIM frequence bar that uses the cache | |
4 | +// | |
5 | +require_once ('jpgraph/jpgraph.php'); | |
6 | +require_once ('jpgraph/jpgraph_bar.php'); | |
7 | +require_once ('jpgraph/jpgraph_line.php'); | |
8 | + | |
9 | + | |
10 | +// Utility function to calculate the accumulated frequence | |
11 | +// for a set of values and ocurrences | |
12 | +function accfreq($data) { | |
13 | + rsort($data); | |
14 | + $s = array_sum($data); | |
15 | + $as = array($data[0]); | |
16 | + $asp = array(100*$as[0]/$s); | |
17 | + $n = count($data); | |
18 | + for( $i=1; $i < $n; ++$i ) { | |
19 | + $as[$i] = $as[$i-1]+$data[$i]; | |
20 | + $asp[$i] = 100.0*$as[$i]/$s; | |
21 | + } | |
22 | + return $asp; | |
23 | +} | |
24 | + | |
25 | +// some data | |
26 | +$data_freq = array(22,20,12,10,5,4,2); | |
27 | +$data_accfreq = accfreq($data_freq); | |
28 | + | |
29 | +// Create the graph. | |
30 | +$graph = new Graph(350,250); | |
31 | + | |
32 | +// We need to make this extra call for CSIM scripts | |
33 | +// that make use of the cache. If the cache contains this | |
34 | +// graph the HTML wrapper will be returned and then the | |
35 | +// method will call exit() and hence NO LINES AFTER THIS | |
36 | +// CALL WILL BE EXECUTED. | |
37 | +// $graph->CheckCSIMCache('auto'); | |
38 | + | |
39 | +// Setup some basic graph parameters | |
40 | +$graph->SetScale("textlin"); | |
41 | +$graph->SetY2Scale('lin',0,100); | |
42 | +$graph->img->SetMargin(50,70,30,40); | |
43 | +$graph->yaxis->SetTitleMargin(30); | |
44 | +$graph->SetMarginColor('#EEEEEE'); | |
45 | + | |
46 | +// Setup titles and fonts | |
47 | +$graph->title->Set("Frequence plot"); | |
48 | +$graph->xaxis->title->Set("X-title"); | |
49 | +$graph->yaxis->title->Set("Y-title"); | |
50 | + | |
51 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
52 | +$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
53 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
54 | + | |
55 | +// Turn the tickmarks | |
56 | +$graph->xaxis->SetTickSide(SIDE_DOWN); | |
57 | +$graph->yaxis->SetTickSide(SIDE_LEFT); | |
58 | + | |
59 | +$graph->y2axis->SetTickSide(SIDE_RIGHT); | |
60 | +$graph->y2axis->SetColor('black','blue'); | |
61 | +$graph->y2axis->SetLabelFormat('%3d.0%%'); | |
62 | + | |
63 | +// Create a bar pot | |
64 | +$bplot = new BarPlot($data_freq); | |
65 | + | |
66 | +// Create targets and alt texts for the image maps. One for each bar | |
67 | +// (In this example this is just "dummy" targets) | |
68 | +$targ=array("#1","#2","#3","#4","#5","#6","#7"); | |
69 | +$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); | |
70 | +$bplot->SetCSIMTargets($targ,$alts); | |
71 | + | |
72 | + | |
73 | +// Create accumulative graph | |
74 | +$lplot = new LinePlot($data_accfreq); | |
75 | + | |
76 | +// We want the line plot data point in the middle of the bars | |
77 | +$lplot->SetBarCenter(); | |
78 | + | |
79 | +// Use transperancy | |
80 | +$lplot->SetFillColor('lightblue@0.6'); | |
81 | +$lplot->SetColor('blue@0.6'); | |
82 | +//$lplot->SetColor('blue'); | |
83 | +$graph->AddY2($lplot); | |
84 | + | |
85 | + | |
86 | +// Setup the bars | |
87 | +$bplot->SetFillColor("orange@0.2"); | |
88 | +$bplot->SetValuePos('center'); | |
89 | +$bplot->value->SetFormat("%d"); | |
90 | +$bplot->value->SetFont(FF_ARIAL,FS_NORMAL,9); | |
91 | +$bplot->value->Show(); | |
92 | + | |
93 | +// Add it to the graph | |
94 | +$graph->Add($bplot); | |
95 | + | |
96 | +// Send back the HTML page which will call this script again | |
97 | +// to retrieve the image. | |
98 | +$graph->StrokeCSIM(); | |
99 | + | |
100 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,84 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// | |
3 | +// Example of frequence bar | |
4 | +// | |
5 | +require_once ('jpgraph/jpgraph.php'); | |
6 | +require_once ('jpgraph/jpgraph_bar.php'); | |
7 | +require_once ('jpgraph/jpgraph_line.php'); | |
8 | + | |
9 | +// Utility function to calculate the accumulated frequence | |
10 | +// for a set of values and ocurrences | |
11 | +function accfreq($data) { | |
12 | + rsort($data); | |
13 | + $s = array_sum($data); | |
14 | + $as = array($data[0]); | |
15 | + $asp = array(100*$as[0]/$s); | |
16 | + $n = count($data); | |
17 | + for( $i=1; $i < $n; ++$i ) { | |
18 | + $as[$i] = $as[$i-1]+$data[$i]; | |
19 | + $asp[$i] = 100.0*$as[$i]/$s; | |
20 | + } | |
21 | + return $asp; | |
22 | +} | |
23 | + | |
24 | +// some data | |
25 | +$data_freq = array(22,20,12,10,5,4,2); | |
26 | +$data_accfreq = accfreq($data_freq); | |
27 | + | |
28 | +// Create the graph. | |
29 | +$graph = new Graph(350,250); | |
30 | +$graph->clearTheme(); | |
31 | + | |
32 | +// Setup some basic graph parameters | |
33 | +$graph->SetScale("textlin"); | |
34 | +$graph->SetY2Scale('lin',0,100); | |
35 | +$graph->img->SetMargin(50,70,30,40); | |
36 | +$graph->yaxis->SetTitleMargin(30); | |
37 | +$graph->SetMarginColor('#EEEEEE'); | |
38 | + | |
39 | +// Setup titles and fonts | |
40 | +$graph->title->Set("Frequence plot"); | |
41 | +$graph->xaxis->title->Set("X-title"); | |
42 | +$graph->yaxis->title->Set("Y-title"); | |
43 | + | |
44 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
45 | +$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
46 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
47 | + | |
48 | +// Turn the tickmarks | |
49 | +$graph->xaxis->SetTickSide(SIDE_DOWN); | |
50 | +$graph->yaxis->SetTickSide(SIDE_LEFT); | |
51 | + | |
52 | +$graph->y2axis->SetTickSide(SIDE_RIGHT); | |
53 | +$graph->y2axis->SetColor('black','blue'); | |
54 | +$graph->y2axis->SetLabelFormat('%3d.0%%'); | |
55 | + | |
56 | +// Create a bar pot | |
57 | +$bplot = new BarPlot($data_freq); | |
58 | + | |
59 | +// Create accumulative graph | |
60 | +$lplot = new LinePlot($data_accfreq); | |
61 | + | |
62 | +// We want the line plot data point in the middle of the bars | |
63 | +$lplot->SetBarCenter(); | |
64 | + | |
65 | +// Use transperancy | |
66 | +$lplot->SetFillColor('lightblue@0.6'); | |
67 | +$lplot->SetColor('blue@0.6'); | |
68 | +$graph->AddY2($lplot); | |
69 | + | |
70 | +// Setup the bars | |
71 | +$bplot->SetFillColor("orange@0.2"); | |
72 | +$bplot->SetValuePos('center'); | |
73 | +$bplot->value->SetFormat("%d"); | |
74 | +$bplot->value->SetFont(FF_ARIAL,FS_NORMAL,9); | |
75 | +$bplot->value->Show(); | |
76 | + | |
77 | +// Add it to the graph | |
78 | +$graph->Add($bplot); | |
79 | + | |
80 | +// Send back the HTML page which will call this script again | |
81 | +// to retrieve the image. | |
82 | +$graph->Stroke(); | |
83 | + | |
84 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | +require_once ('jpgraph/jpgraph_line.php'); | |
6 | + | |
7 | +$datay=array(2,3,5,8.5,11.5,6,3); | |
8 | + | |
9 | +// Create the graph. | |
10 | +$graph = new Graph(350,300); | |
11 | +$graph->clearTheme(); | |
12 | + | |
13 | +$graph->SetScale("textlin"); | |
14 | + | |
15 | +$graph->SetMarginColor('navy:1.9'); | |
16 | +$graph->SetBox(); | |
17 | + | |
18 | +$graph->title->Set('Bar Pattern'); | |
19 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,20); | |
20 | + | |
21 | +$graph->SetTitleBackground('lightblue:1.3',TITLEBKG_STYLE2,TITLEBKG_FRAME_BEVEL); | |
22 | +$graph->SetTitleBackgroundFillStyle(TITLEBKG_FILLSTYLE_HSTRIPED,'lightblue','blue'); | |
23 | + | |
24 | +// Create a bar pot | |
25 | +$bplot = new BarPlot($datay); | |
26 | +$bplot->SetFillColor('darkorange'); | |
27 | +$bplot->SetWidth(0.6); | |
28 | + | |
29 | +$bplot->SetPattern(PATTERN_CROSS1,'navy'); | |
30 | + | |
31 | +$graph->Add($bplot); | |
32 | + | |
33 | +$graph->Stroke(); | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,64 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Callback function for Y-scale to get 1000 separator on labels | |
6 | +function separator1000($aVal) { | |
7 | + return number_format($aVal); | |
8 | +} | |
9 | + | |
10 | +function separator1000_usd($aVal) { | |
11 | + return '$'.number_format($aVal); | |
12 | +} | |
13 | + | |
14 | +// Some data | |
15 | +$datay=array(120567,134013,192000,87000); | |
16 | + | |
17 | +// Create the graph and setup the basic parameters | |
18 | +$graph = new Graph(500,300,'auto'); | |
19 | +$graph->clearTheme(); | |
20 | +$graph->img->SetMargin(80,30,30,40); | |
21 | +$graph->SetScale('textint'); | |
22 | +$graph->SetShadow(); | |
23 | +$graph->SetFrame(false); // No border around the graph | |
24 | + | |
25 | +// Add some grace to the top so that the scale doesn't | |
26 | +// end exactly at the max value. | |
27 | +// The grace value is the percetage of additional scale | |
28 | +// value we add. Specifying 50 means that we add 50% of the | |
29 | +// max value | |
30 | +$graph->yaxis->scale->SetGrace(50); | |
31 | +$graph->yaxis->SetLabelFormatCallback('separator1000'); | |
32 | + | |
33 | +// Setup X-axis labels | |
34 | +$a = $gDateLocale->GetShortMonth(); | |
35 | +$graph->xaxis->SetTickLabels($a); | |
36 | +$graph->xaxis->SetFont(FF_FONT2); | |
37 | + | |
38 | +// Setup graph title ands fonts | |
39 | +$graph->title->Set('Example of Y-scale callback formatting'); | |
40 | +$graph->title->SetFont(FF_FONT2,FS_BOLD); | |
41 | +$graph->xaxis->title->Set('Year 2002'); | |
42 | +$graph->xaxis->title->SetFont(FF_FONT2,FS_BOLD); | |
43 | + | |
44 | +// Create a bar pot | |
45 | +$bplot = new BarPlot($datay); | |
46 | +$bplot->SetFillColor('orange'); | |
47 | +$bplot->SetWidth(0.5); | |
48 | +$bplot->SetShadow(); | |
49 | + | |
50 | +// Setup the values that are displayed on top of each bar | |
51 | +$bplot->value->Show(); | |
52 | + | |
53 | +// Must use TTF fonts if we want text at an arbitrary angle | |
54 | +$bplot->value->SetFont(FF_ARIAL,FS_BOLD); | |
55 | +$bplot->value->SetAngle(45); | |
56 | +$bplot->value->SetFormatCallback('separator1000_usd'); | |
57 | + | |
58 | +// Black color for positive values and darkred for negative values | |
59 | +$bplot->value->SetColor('black','darkred'); | |
60 | +$graph->Add($bplot); | |
61 | + | |
62 | +// Finally stroke the graph | |
63 | +$graph->Stroke(); | |
64 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$databary=array(12,7,16,5,7,14,9,3); | |
7 | + | |
8 | +// New graph with a drop shadow | |
9 | +$graph = new Graph(300,200); | |
10 | +$graph->clearTheme(); | |
11 | +$graph->SetShadow(); | |
12 | + | |
13 | +// Use a "text" X-scale | |
14 | +$graph->SetScale("textlin"); | |
15 | + | |
16 | +// Set title and subtitle | |
17 | +$graph->title->Set("Elementary barplot with a text scale"); | |
18 | + | |
19 | +// Use built in font | |
20 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
21 | + | |
22 | +// Create the bar plot | |
23 | +$b1 = new BarPlot($databary); | |
24 | +$b1->SetLegend("Temperature"); | |
25 | +//$b1->SetAbsWidth(6); | |
26 | +//$b1->SetShadow(); | |
27 | + | |
28 | +// The order the plots are added determines who's ontop | |
29 | +$graph->Add($b1); | |
30 | + | |
31 | +// Finally output the image | |
32 | +$graph->Stroke(); | |
33 | + | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,89 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// A medium complex example of JpGraph | |
3 | +// Note: You can create a graph in far fewwr lines of code if you are | |
4 | +// willing to go with the defaults. This is an illustrative example of | |
5 | +// some of the capabilities of JpGraph. | |
6 | + | |
7 | +require_once ('jpgraph/jpgraph.php'); | |
8 | +require_once ('jpgraph/jpgraph_line.php'); | |
9 | +require_once ('jpgraph/jpgraph_bar.php'); | |
10 | + | |
11 | +$month=array( | |
12 | +"Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"); | |
13 | + | |
14 | +// Create some datapoints | |
15 | +$steps=100; | |
16 | +for($i=0; $i<$steps; ++$i) { | |
17 | + $databarx[]=sprintf("198%d %s",floor($i/12),$month[$i%12]); | |
18 | + $datay[$i]=log(pow($i,$i/10)+1)*sin($i/15)+35; | |
19 | + if( $i % 6 == 0 && $i<$steps-6) { | |
20 | + $databary[]=abs(25*sin($i)+5); | |
21 | + } | |
22 | + else { | |
23 | + $databary[]=0; | |
24 | + } | |
25 | +} | |
26 | + | |
27 | +// New graph with a background image and drop shadow | |
28 | +$graph = new Graph(450,300); | |
29 | +$graph->clearTheme(); | |
30 | +$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME); | |
31 | +$graph->SetShadow(); | |
32 | + | |
33 | +// Use text X-scale so we can text labels on the X-axis | |
34 | +$graph->SetScale("textlin"); | |
35 | + | |
36 | +// Y2-axis is linear | |
37 | +$graph->SetY2Scale("lin"); | |
38 | + | |
39 | +// Color the two Y-axis to make them easier to associate | |
40 | +// to the corresponding plot (we keep the axis black though) | |
41 | +$graph->yaxis->SetColor("black","red"); | |
42 | +$graph->y2axis->SetColor("black","orange"); | |
43 | + | |
44 | +// Set title and subtitle | |
45 | +$graph->title->Set("Combined bar and line plot"); | |
46 | +$graph->subtitle->Set("100 data points, X-Scale: 'text'"); | |
47 | + | |
48 | +// Use built in font (don't need TTF support) | |
49 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
50 | + | |
51 | +// Make the margin around the plot a little bit bigger then default | |
52 | +$graph->img->SetMargin(40,140,40,80); | |
53 | + | |
54 | +// Slightly adjust the legend from it's default position in the | |
55 | +// top right corner to middle right side | |
56 | +$graph->legend->Pos(0.03,0.5,"right","center"); | |
57 | + | |
58 | +// Display every 6:th tickmark | |
59 | +$graph->xaxis->SetTextTickInterval(6); | |
60 | + | |
61 | +// Label every 2:nd tick mark | |
62 | +$graph->xaxis->SetTextLabelInterval(2); | |
63 | + | |
64 | +// Setup the labels | |
65 | +$graph->xaxis->SetTickLabels($databarx); | |
66 | +$graph->xaxis->SetLabelAngle(90); | |
67 | + | |
68 | +// Create a red line plot | |
69 | +$p1 = new LinePlot($datay); | |
70 | +$p1->SetColor("red"); | |
71 | +$p1->SetLegend("Pressure"); | |
72 | + | |
73 | +// Create the bar plot | |
74 | +$b1 = new BarPlot($databary); | |
75 | +$b1->SetLegend("Temperature"); | |
76 | +$b1->SetFillColor("orange"); | |
77 | +$b1->SetAbsWidth(8); | |
78 | + | |
79 | +// Drop shadow on bars adjust the default values a little bit | |
80 | +$b1->SetShadow("steelblue",2,2); | |
81 | + | |
82 | +// The order the plots are added determines who's ontop | |
83 | +$graph->Add($p1); | |
84 | +$graph->AddY2($b1); | |
85 | + | |
86 | +// Finally output the image | |
87 | +$graph->Stroke(); | |
88 | + | |
89 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$databary=array(12,7,16,6,7,14,9,3); | |
7 | +$months=$gDateLocale->GetShortMonth(); | |
8 | + | |
9 | +// New graph with a drop shadow | |
10 | +$graph = new Graph(300,200,'auto'); | |
11 | +$graph->clearTheme(); | |
12 | +$graph->SetShadow(); | |
13 | + | |
14 | +// Use a "text" X-scale | |
15 | +$graph->SetScale("textlin"); | |
16 | + | |
17 | +// Specify X-labels | |
18 | +$graph->xaxis->SetTickLabels($months); | |
19 | + | |
20 | +// Set title and subtitle | |
21 | +$graph->title->Set("Textscale with specified labels"); | |
22 | + | |
23 | +// Use built in font | |
24 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
25 | + | |
26 | +// Create the bar plot | |
27 | +$b1 = new BarPlot($databary); | |
28 | +$b1->SetLegend("Temperature"); | |
29 | + | |
30 | +//$b1->SetAbsWidth(6); | |
31 | +//$b1->SetShadow(); | |
32 | + | |
33 | +// The order the plots are added determines who's ontop | |
34 | +$graph->Add($b1); | |
35 | + | |
36 | +// Finally output the image | |
37 | +$graph->Stroke(); | |
38 | + | |
39 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,43 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$months=$gDateLocale->GetShortMonth(); | |
7 | + | |
8 | +srand ((double) microtime() * 1000000); | |
9 | +for( $i=0; $i<25; ++$i) { | |
10 | + $databary[]=rand(1,50); | |
11 | + $databarx[]=$months[$i%12]; | |
12 | +} | |
13 | + | |
14 | +// New graph with a drop shadow | |
15 | +$graph = new Graph(300,200,'auto'); | |
16 | +$graph->clearTheme(); | |
17 | +$graph->SetShadow(); | |
18 | + | |
19 | +// Use a "text" X-scale | |
20 | +$graph->SetScale("textlin"); | |
21 | + | |
22 | +// Specify X-labels | |
23 | +$graph->xaxis->SetTickLabels($databarx); | |
24 | + | |
25 | +// Set title and subtitle | |
26 | +$graph->title->Set("Bar tutorial example 3"); | |
27 | + | |
28 | +// Use built in font | |
29 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
30 | + | |
31 | +// Create the bar plot | |
32 | +$b1 = new BarPlot($databary); | |
33 | +$b1->SetLegend("Temperature"); | |
34 | +//$b1->SetAbsWidth(6); | |
35 | +//$b1->SetShadow(); | |
36 | + | |
37 | +// The order the plots are added determines who's ontop | |
38 | +$graph->Add($b1); | |
39 | + | |
40 | +// Finally output the image | |
41 | +$graph->Stroke(); | |
42 | + | |
43 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,46 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$months=$gDateLocale->GetShortMonth(); | |
7 | + | |
8 | +srand ((double) microtime() * 1000000); | |
9 | +for( $i=0; $i<25; ++$i) { | |
10 | + $databary[]=rand(1,50); | |
11 | + $databarx[]=$months[$i%12]; | |
12 | +} | |
13 | + | |
14 | +// New graph with a drop shadow | |
15 | +$graph = new Graph(300,200,'auto'); | |
16 | +$graph->clearTheme(); | |
17 | +$graph->SetShadow(); | |
18 | + | |
19 | +// Use a "text" X-scale | |
20 | +$graph->SetScale("textlin"); | |
21 | + | |
22 | +// Specify X-labels | |
23 | +//$databarx = array('tXi','','','xxx','','','iXii','','','OOO','','','tOO'); | |
24 | +$graph->xaxis->SetFont(FF_FONT1,FS_NORMAL); | |
25 | +$graph->xaxis->SetTickLabels($databarx); | |
26 | +$graph->xaxis->SetTextLabelInterval(3); | |
27 | + | |
28 | +// Set title and subtitle | |
29 | +$graph->title->Set("Displaying only every third label"); | |
30 | + | |
31 | +// Use built in font | |
32 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
33 | + | |
34 | +// Create the bar plot | |
35 | +$b1 = new BarPlot($databary); | |
36 | +$b1->SetLegend("Temperature"); | |
37 | +//$b1->SetAbsWidth(6); | |
38 | +//$b1->SetShadow(); | |
39 | + | |
40 | +// The order the plots are added determines who's ontop | |
41 | +$graph->Add($b1); | |
42 | + | |
43 | +// Finally output the image | |
44 | +$graph->Stroke(); | |
45 | + | |
46 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,44 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$months=$gDateLocale->GetShortMonth(); | |
7 | + | |
8 | +srand ((double) microtime() * 1000000); | |
9 | +for( $i=0; $i<25; ++$i) { | |
10 | + $databary[]=rand(1,50); | |
11 | + $databarx[]=$months[$i%12]; | |
12 | +} | |
13 | + | |
14 | +// New graph with a drop shadow | |
15 | +$graph = new Graph(300,200,'auto'); | |
16 | +$graph->clearTheme(); | |
17 | +$graph->SetShadow(); | |
18 | + | |
19 | +// Use a "text" X-scale | |
20 | +$graph->SetScale("textlin"); | |
21 | + | |
22 | +// Specify X-labels | |
23 | +$graph->xaxis->SetTickLabels($databarx); | |
24 | +$graph->xaxis->SetTextLabelInterval(1); | |
25 | +$graph->xaxis->SetTextTickInterval(3); | |
26 | + | |
27 | +// Set title and subtitle | |
28 | +$graph->title->Set("Bar tutorial example 5"); | |
29 | + | |
30 | +// Use built in font | |
31 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
32 | + | |
33 | +// Create the bar plot | |
34 | +$b1 = new BarPlot($databary); | |
35 | +$b1->SetLegend("Temperature"); | |
36 | +$b1->SetWidth(0.4); | |
37 | + | |
38 | +// The order the plots are added determines who's ontop | |
39 | +$graph->Add($b1); | |
40 | + | |
41 | +// Finally output the image | |
42 | +$graph->Stroke(); | |
43 | + | |
44 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,46 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_bar.php'); | |
4 | + | |
5 | +// Some data | |
6 | +$months=$gDateLocale->GetShortMonth(); | |
7 | +srand ((double) microtime() * 1000000); | |
8 | +for( $i=0; $i<25; ++$i) { | |
9 | + $databary[]=rand(1,50); | |
10 | + $databarx[]=$months[$i%12]; | |
11 | +} | |
12 | + | |
13 | +// New graph with a drop shadow | |
14 | +$graph = new Graph(300,200,'auto'); | |
15 | +$graph->clearTheme(); | |
16 | +$graph->SetShadow(); | |
17 | + | |
18 | +// Use a "text" X-scale | |
19 | +$graph->SetScale("textlin"); | |
20 | + | |
21 | +// Specify X-labels | |
22 | +$graph->xaxis->SetTickLabels($databarx); | |
23 | +$graph->xaxis->SetTextLabelInterval(3); | |
24 | + | |
25 | +// Hide the tick marks | |
26 | +$graph->xaxis->HideTicks(); | |
27 | + | |
28 | +// Set title and subtitle | |
29 | +$graph->title->Set("Bar tutorial example 6"); | |
30 | + | |
31 | +// Use built in font | |
32 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
33 | + | |
34 | +// Create the bar plot | |
35 | +$b1 = new BarPlot($databary); | |
36 | +$b1->SetLegend("Temperature"); | |
37 | +$b1->SetWidth(0.4); | |
38 | + | |
39 | + | |
40 | +// The order the plots are added determines who's ontop | |
41 | +$graph->Add($b1); | |
42 | + | |
43 | +// Finally output the image | |
44 | +$graph->Stroke(); | |
45 | + | |
46 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,40 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Basic contour plot example | |
3 | + | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_contour.php'); | |
6 | + | |
7 | +$data = array( | |
8 | + array (0.5,1.1,1.5,1,2.0,3,3,2,1,0.1), | |
9 | + array (1.0,1.5,3.0,5,6.0,2,1,1.2,1,4), | |
10 | + array (0.9,2.0,2.1,3,6.0,7,3,2,1,1.4), | |
11 | + array (1.0,1.5,3.0,4,6.0,5,2,1.5,1,2), | |
12 | + array (0.8,2.0,3.0,3,4.0,4,3,2.4,2,3), | |
13 | + array (0.6,1.1,1.5,1,4.0,3.5,3,2,3,4), | |
14 | + array (1.0,1.5,3.0,5,6.0,2,1,1.2,2.7,4), | |
15 | + array (0.8,2.0,3.0,3,5.5,6,3,2,1,1.4), | |
16 | + array (1.0,1.5,3.0,4,6.0,5,2,1,0.5,0.2)); | |
17 | + | |
18 | +// Basic contour graph | |
19 | +$graph = new Graph(350,250); | |
20 | +$graph->SetScale('intint'); | |
21 | + | |
22 | +// Adjust the margins to fit the margin | |
23 | +$graph->SetMargin(30,100,40,30); | |
24 | + | |
25 | +// Setup | |
26 | +$graph->title->Set('Basic contour plot'); | |
27 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
28 | + | |
29 | +// A simple contour plot with default arguments (e.g. 10 isobar lines) | |
30 | +$cp = new ContourPlot($data); | |
31 | + | |
32 | +// Display the legend | |
33 | +$cp->ShowLegend(); | |
34 | + | |
35 | +$graph->Add($cp); | |
36 | + | |
37 | +// ... and send the graph back to the browser | |
38 | +$graph->Stroke(); | |
39 | + | |
40 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,43 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Basic contour plot example | |
3 | + | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_contour.php'); | |
6 | + | |
7 | +$data = array( | |
8 | + array (0.5,1.1,1.5,1,2.0,3,3,2,1,0.1), | |
9 | + array (1.0,1.5,3.0,5,6.0,2,1,1.2,1,4), | |
10 | + array (0.9,2.0,2.1,3,6.0,7,3,2,1,1.4), | |
11 | + array (1.0,1.5,3.0,4,6.0,5,2,1.5,1,2), | |
12 | + array (0.8,2.0,3.0,3,4.0,4,3,2.4,2,3), | |
13 | + array (0.6,1.1,1.5,1,4.0,3.5,3,2,3,4), | |
14 | + array (1.0,1.5,3.0,5,6.0,2,1,1.2,2.7,4), | |
15 | + array (0.8,2.0,3.0,3,5.5,6,3,2,1,1.4), | |
16 | + array (1.0,1.5,3.0,4,6.0,5,2,1,0.5,0.2)); | |
17 | + | |
18 | +// Basic contour graph | |
19 | +$graph = new Graph(350,250); | |
20 | +$graph->SetScale('intint'); | |
21 | + | |
22 | +// Show axis on all sides | |
23 | +$graph->SetAxisStyle(AXSTYLE_BOXOUT); | |
24 | + | |
25 | +// Adjust the margins to fit the margin | |
26 | +$graph->SetMargin(30,100,40,30); | |
27 | + | |
28 | +// Setup | |
29 | +$graph->title->Set('Basic contour plot with multiple axis'); | |
30 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
31 | + | |
32 | +// A simple contour plot with default arguments (e.g. 10 isobar lines) | |
33 | +$cp = new ContourPlot($data); | |
34 | + | |
35 | +// Display the legend | |
36 | +$cp->ShowLegend(); | |
37 | + | |
38 | +$graph->Add($cp); | |
39 | + | |
40 | +// ... and send the graph back to the browser | |
41 | +$graph->Stroke(); | |
42 | + | |
43 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,40 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Basic contour plot example | |
3 | + | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_contour.php'); | |
6 | + | |
7 | +$data = array( | |
8 | + array ( 12,7,3,15 ), | |
9 | + array ( 18,5,1, 9 ), | |
10 | + array ( 13,9,5,12), | |
11 | + array ( 5,3,8, 9 ), | |
12 | + array ( 1,8,5, 7 )); | |
13 | + | |
14 | + | |
15 | +// Basic contour graph | |
16 | +$graph = new Graph(350,250); | |
17 | +$graph->SetScale('intint'); | |
18 | + | |
19 | +// Show axis on all sides | |
20 | +$graph->SetAxisStyle(AXSTYLE_BOXOUT); | |
21 | + | |
22 | +// Adjust the margins to fit the margin | |
23 | +$graph->SetMargin(30,100,40,30); | |
24 | + | |
25 | +// Setup | |
26 | +$graph->title->Set('Basic contour plot with multiple axis'); | |
27 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
28 | + | |
29 | +// A simple contour plot with default arguments (e.g. 10 isobar lines) | |
30 | +$cp = new ContourPlot($data,10,1); | |
31 | + | |
32 | +// Display the legend | |
33 | +$cp->ShowLegend(); | |
34 | + | |
35 | +$graph->Add($cp); | |
36 | + | |
37 | +// ... and send the graph back to the browser | |
38 | +$graph->Stroke(); | |
39 | + | |
40 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,40 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Basic contour plot example | |
3 | + | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_contour.php'); | |
6 | + | |
7 | +$data = array( | |
8 | + array ( 12,7,3,15 ), | |
9 | + array ( 18,5,1, 9 ), | |
10 | + array ( 13,9,5,12), | |
11 | + array ( 5,3,8, 9 ), | |
12 | + array ( 1,8,5, 7 )); | |
13 | + | |
14 | + | |
15 | +// Basic contour graph | |
16 | +$graph = new Graph(350,250); | |
17 | +$graph->SetScale('intint'); | |
18 | + | |
19 | +// Show axis on all sides | |
20 | +$graph->SetAxisStyle(AXSTYLE_BOXOUT); | |
21 | + | |
22 | +// Adjust the margins to fit the margin | |
23 | +$graph->SetMargin(30,100,40,30); | |
24 | + | |
25 | +// Setup | |
26 | +$graph->title->Set('Basic contour plot with multiple axis'); | |
27 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
28 | + | |
29 | +// A simple contour plot with default arguments (e.g. 10 isobar lines) | |
30 | +$cp = new ContourPlot($data,10,2); | |
31 | + | |
32 | +// Display the legend | |
33 | +$cp->ShowLegend(); | |
34 | + | |
35 | +$graph->Add($cp); | |
36 | + | |
37 | +// ... and send the graph back to the browser | |
38 | +$graph->Stroke(); | |
39 | + | |
40 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,40 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Basic contour plot example | |
3 | + | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_contour.php'); | |
6 | + | |
7 | +$data = array( | |
8 | + array ( 12,7,3,15 ), | |
9 | + array ( 18,5,1, 9 ), | |
10 | + array ( 13,9,5,12), | |
11 | + array ( 5,3,8, 9 ), | |
12 | + array ( 1,8,5, 7 )); | |
13 | + | |
14 | + | |
15 | +// Basic contour graph | |
16 | +$graph = new Graph(350,250); | |
17 | +$graph->SetScale('intint'); | |
18 | + | |
19 | +// Show axis on all sides | |
20 | +$graph->SetAxisStyle(AXSTYLE_BOXOUT); | |
21 | + | |
22 | +// Adjust the margins to fit the margin | |
23 | +$graph->SetMargin(30,100,40,30); | |
24 | + | |
25 | +// Setup | |
26 | +$graph->title->Set('Basic contour plot with multiple axis'); | |
27 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
28 | + | |
29 | +// A simple contour plot with default arguments (e.g. 10 isobar lines) | |
30 | +$cp = new ContourPlot($data,10,3); | |
31 | + | |
32 | +// Display the legend | |
33 | +$cp->ShowLegend(); | |
34 | + | |
35 | +$graph->Add($cp); | |
36 | + | |
37 | +// ... and send the graph back to the browser | |
38 | +$graph->Stroke(); | |
39 | + | |
40 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,43 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Basic contour plot example | |
3 | + | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_contour.php'); | |
6 | + | |
7 | +$data = array( | |
8 | + array (0.5,1.1,1.5,1,2.0,3,3,2,1,0.1), | |
9 | + array (1.0,1.5,3.0,5,6.0,2,1,1.2,1,4), | |
10 | + array (0.9,2.0,2.1,3,6.0,7,3,2,1,1.4), | |
11 | + array (1.0,1.5,3.0,4,6.0,5,2,1.5,1,2), | |
12 | + array (0.8,2.0,3.0,3,4.0,4,3,2.4,2,3), | |
13 | + array (0.6,1.1,1.5,1,4.0,3.5,3,2,3,4), | |
14 | + array (1.0,1.5,3.0,5,6.0,2,1,1.2,2.7,4), | |
15 | + array (0.8,2.0,3.0,3,5.5,6,3,2,1,1.4), | |
16 | + array (1.0,1.5,3.0,4,6.0,5,2,1,0.5,0.2)); | |
17 | + | |
18 | +// Basic contour graph | |
19 | +$graph = new Graph(350,250); | |
20 | +$graph->SetScale('intint'); | |
21 | + | |
22 | +// Show axis on all sides | |
23 | +$graph->SetAxisStyle(AXSTYLE_BOXOUT); | |
24 | + | |
25 | +// Adjust the margins to fit the margin | |
26 | +$graph->SetMargin(30,100,40,30); | |
27 | + | |
28 | +// Setup | |
29 | +$graph->title->Set('Basic contour plot with multiple axis'); | |
30 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
31 | + | |
32 | +// A simple contour plot with default arguments (e.g. 10 isobar lines) | |
33 | +$cp = new ContourPlot($data,5); | |
34 | + | |
35 | +// Display the legend | |
36 | +$cp->ShowLegend(); | |
37 | + | |
38 | +$graph->Add($cp); | |
39 | + | |
40 | +// ... and send the graph back to the browser | |
41 | +$graph->Stroke(); | |
42 | + | |
43 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,46 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Basic contour plot example | |
3 | + | |
4 | +require_once ('jpgraph/jpgraph.php'); | |
5 | +require_once ('jpgraph/jpgraph_contour.php'); | |
6 | + | |
7 | +$data = array( | |
8 | + array (0.5,1.1,1.5,1,2.0,3,3,2,1,0.1), | |
9 | + array (1.0,1.5,3.0,5,6.0,2,1,1.2,1,4), | |
10 | + array (0.9,2.0,2.1,3,6.0,7,3,2,1,1.4), | |
11 | + array (1.0,1.5,3.0,4,6.0,5,2,1.5,1,2), | |
12 | + array (0.8,2.0,3.0,3,4.0,4,3,2.4,2,3), | |
13 | + array (0.6,1.1,1.5,1,4.0,3.5,3,2,3,4), | |
14 | + array (1.0,1.5,3.0,5,6.0,2,1,1.2,2.7,4), | |
15 | + array (0.8,2.0,3.0,3,5.5,6,3,2,1,1.4), | |
16 | + array (1.0,1.5,3.0,4,6.0,5,2,1,0.5,0.2)); | |
17 | + | |
18 | +// Basic contour graph | |
19 | +$graph = new Graph(350,250); | |
20 | +$graph->SetScale('intint'); | |
21 | + | |
22 | +// Show axis on all sides | |
23 | +$graph->SetAxisStyle(AXSTYLE_BOXOUT); | |
24 | + | |
25 | +// Adjust the margins to fit the margin | |
26 | +$graph->SetMargin(30,100,40,30); | |
27 | + | |
28 | +// Setup | |
29 | +$graph->title->Set('Basic contour plot with multiple axis'); | |
30 | +$graph->title->SetFont(FF_ARIAL,FS_BOLD,12); | |
31 | + | |
32 | +// A simple contour plot with default arguments (e.g. 10 isobar lines) | |
33 | +$cp = new ContourPlot($data); | |
34 | + | |
35 | +// Flip the data around its center line | |
36 | +$cp->SetInvert(); | |
37 | + | |
38 | +// Display the legend | |
39 | +$cp->ShowLegend(); | |
40 | + | |
41 | +$graph->Add($cp); | |
42 | + | |
43 | +// ... and send the graph back to the browser | |
44 | +$graph->Stroke(); | |
45 | + | |
46 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,54 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | +require_once ('jpgraph/jpgraph_scatter.php'); | |
5 | +require_once ('jpgraph/jpgraph_regstat.php'); | |
6 | + | |
7 | +// Original data points | |
8 | +$xdata = array(1,3,12,15); | |
9 | +$ydata = array(5,15,2,19); | |
10 | + | |
11 | +// Get the interpolated values by creating | |
12 | +// a new Spline object. | |
13 | +$bez = new Bezier($xdata,$ydata); | |
14 | + | |
15 | +// For the new data set we want 40 points to | |
16 | +// get a smooth curve. | |
17 | +list($newx,$newy) = $bez->Get(50); | |
18 | + | |
19 | +// Create the graph | |
20 | +$g = new Graph(300,200); | |
21 | +$g->clearTheme(); | |
22 | +$g->SetMargin(30,20,40,30); | |
23 | +$g->title->Set("Bezier interpolation"); | |
24 | +$g->title->SetFont(FF_ARIAL,FS_NORMAL,12); | |
25 | +$g->subtitle->Set('(Control points shown in red)'); | |
26 | +$g->subtitle->SetColor('darkred'); | |
27 | +$g->SetMarginColor('lightblue'); | |
28 | + | |
29 | +//$g->img->SetAntiAliasing(); | |
30 | + | |
31 | +// We need a linlin scale since we provide both | |
32 | +// x and y coordinates for the data points. | |
33 | +$g->SetScale('linlin'); | |
34 | + | |
35 | +// We want 1 decimal for the X-label | |
36 | +$g->xaxis->SetLabelFormat('%1.1f'); | |
37 | + | |
38 | +// We use a scatterplot to illustrate the original | |
39 | +// contro points. | |
40 | +$bplot = new ScatterPlot($ydata,$xdata); | |
41 | +$bplot->mark->SetFillColor('red@0.3'); | |
42 | +$bplot->mark->SetColor('red@0.5'); | |
43 | + | |
44 | +// And a line plot to stroke the smooth curve we got | |
45 | +// from the original control points | |
46 | +$lplot = new LinePlot($newy,$newx); | |
47 | +$lplot->SetColor('navy'); | |
48 | + | |
49 | +// Add the plots to the graph and stroke | |
50 | +$g->Add($lplot); | |
51 | +$g->Add($bplot); | |
52 | +$g->Stroke(); | |
53 | + | |
54 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,79 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | +require_once ('jpgraph/jpgraph_flags.php'); | |
6 | + | |
7 | +// Some data | |
8 | +$datay1=array(140,110,50); | |
9 | +$datay2=array(35,90,190); | |
10 | +$datay3=array(20,60,70); | |
11 | + | |
12 | +// Create the basic graph | |
13 | +$graph = new Graph(300,200); | |
14 | +$graph->clearTheme(); | |
15 | +$graph->SetScale('textlin'); | |
16 | +$graph->SetMargin(40,20,20,40); | |
17 | +$graph->SetMarginColor('white:0.9'); | |
18 | +$graph->SetColor('white'); | |
19 | +$graph->SetShadow(); | |
20 | + | |
21 | +// Adjust the position of the legend box | |
22 | +$graph->legend->Pos(0.03,0.10); | |
23 | + | |
24 | +// Adjust the color for theshadow of the legend | |
25 | +$graph->legend->SetShadow('darkgray@0.5'); | |
26 | +$graph->legend->SetFillColor('lightblue@0.1'); | |
27 | +$graph->legend->Hide(); | |
28 | + | |
29 | +// Get localised version of the month names | |
30 | +$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); | |
31 | +$graph->SetBackgroundCountryFlag('mais',BGIMG_COPY,50); | |
32 | + | |
33 | +// Set axis titles and fonts | |
34 | +$graph->xaxis->title->Set('Year 2002'); | |
35 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
36 | +$graph->xaxis->title->SetColor('white'); | |
37 | + | |
38 | +$graph->xaxis->SetFont(FF_FONT1,FS_BOLD); | |
39 | +$graph->xaxis->SetColor('navy'); | |
40 | + | |
41 | +$graph->yaxis->SetFont(FF_FONT1,FS_BOLD); | |
42 | +$graph->yaxis->SetColor('navy'); | |
43 | + | |
44 | +//$graph->ygrid->Show(false); | |
45 | +$graph->ygrid->SetColor('white@0.5'); | |
46 | + | |
47 | +// Setup graph title | |
48 | +$graph->title->Set('Using a country flag background'); | |
49 | + | |
50 | +// Some extra margin (from the top) | |
51 | +$graph->title->SetMargin(3); | |
52 | +$graph->title->SetFont(FF_ARIAL,FS_NORMAL,12); | |
53 | + | |
54 | +// Create the three var series we will combine | |
55 | +$bplot1 = new BarPlot($datay1); | |
56 | +$bplot2 = new BarPlot($datay2); | |
57 | +$bplot3 = new BarPlot($datay3); | |
58 | + | |
59 | +// Setup the colors with 40% transparency (alpha channel) | |
60 | +$bplot1->SetFillColor('yellow@0.4'); | |
61 | +$bplot2->SetFillColor('red@0.4'); | |
62 | +$bplot3->SetFillColor('darkgreen@0.4'); | |
63 | + | |
64 | +// Setup legends | |
65 | +$bplot1->SetLegend('Label 1'); | |
66 | +$bplot2->SetLegend('Label 2'); | |
67 | +$bplot3->SetLegend('Label 3'); | |
68 | + | |
69 | +// Setup each bar with a shadow of 50% transparency | |
70 | +$bplot1->SetShadow('black@0.4'); | |
71 | +$bplot2->SetShadow('black@0.4'); | |
72 | +$bplot3->SetShadow('black@0.4'); | |
73 | + | |
74 | +$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3)); | |
75 | +$gbarplot->SetWidth(0.6); | |
76 | +$graph->Add($gbarplot); | |
77 | + | |
78 | +$graph->Stroke(); | |
79 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,83 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | +require_once ('jpgraph/jpgraph_flags.php'); | |
6 | + | |
7 | +// Some data | |
8 | +$datay1=array(140,110,50); | |
9 | +$datay2=array(35,90,190); | |
10 | +$datay3=array(20,60,70); | |
11 | + | |
12 | +// Create the basic graph | |
13 | +$graph = new Graph(300,200); | |
14 | +$graph->clearTheme(); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMargin(40,20,20,40); | |
17 | +$graph->SetMarginColor('white:0.9'); | |
18 | +$graph->SetColor('white'); | |
19 | +$graph->SetShadow(); | |
20 | + | |
21 | +// Apply a perspective transformation at the end | |
22 | +$graph->Set3DPerspective(SKEW3D_UP,100,180); | |
23 | + | |
24 | +// Adjust the position of the legend box | |
25 | +$graph->legend->Pos(0.03,0.10); | |
26 | + | |
27 | +// Adjust the color for theshadow of the legend | |
28 | +$graph->legend->SetShadow('darkgray@0.5'); | |
29 | +$graph->legend->SetFillColor('lightblue@0.1'); | |
30 | +$graph->legend->Hide(); | |
31 | + | |
32 | +// Get localised version of the month names | |
33 | +$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); | |
34 | + | |
35 | +$graph->SetBackgroundCountryFlag('mais',BGIMG_COPY,50); | |
36 | + | |
37 | +// Set axis titles and fonts | |
38 | +$graph->xaxis->title->Set('Year 2002'); | |
39 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
40 | +$graph->xaxis->title->SetColor('white'); | |
41 | + | |
42 | +$graph->xaxis->SetFont(FF_FONT1,FS_BOLD); | |
43 | +$graph->xaxis->SetColor('navy'); | |
44 | + | |
45 | +$graph->yaxis->SetFont(FF_FONT1,FS_BOLD); | |
46 | +$graph->yaxis->SetColor('navy'); | |
47 | + | |
48 | +//$graph->ygrid->Show(false); | |
49 | +$graph->ygrid->SetColor('white@0.5'); | |
50 | + | |
51 | +// Setup graph title | |
52 | +$graph->title->Set('Using a country flag background'); | |
53 | + | |
54 | +// Some extra margin (from the top) | |
55 | +$graph->title->SetMargin(3); | |
56 | +$graph->title->SetFont(FF_ARIAL,FS_NORMAL,12); | |
57 | + | |
58 | +// Create the three var series we will combine | |
59 | +$bplot1 = new BarPlot($datay1); | |
60 | +$bplot2 = new BarPlot($datay2); | |
61 | +$bplot3 = new BarPlot($datay3); | |
62 | + | |
63 | +// Setup the colors with 40% transparency (alpha channel) | |
64 | +$bplot1->SetFillColor('yellow@0.4'); | |
65 | +$bplot2->SetFillColor('red@0.4'); | |
66 | +$bplot3->SetFillColor('darkgreen@0.4'); | |
67 | + | |
68 | +// Setup legends | |
69 | +$bplot1->SetLegend('Label 1'); | |
70 | +$bplot2->SetLegend('Label 2'); | |
71 | +$bplot3->SetLegend('Label 3'); | |
72 | + | |
73 | +// Setup each bar with a shadow of 50% transparency | |
74 | +$bplot1->SetShadow('black@0.4'); | |
75 | +$bplot2->SetShadow('black@0.4'); | |
76 | +$bplot3->SetShadow('black@0.4'); | |
77 | + | |
78 | +$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3)); | |
79 | +$gbarplot->SetWidth(0.6); | |
80 | +$graph->Add($gbarplot); | |
81 | + | |
82 | +$graph->Stroke(); | |
83 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,83 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | +require_once ('jpgraph/jpgraph_flags.php'); | |
6 | + | |
7 | +// Some data | |
8 | +$datay1=array(140,110,50); | |
9 | +$datay2=array(35,90,190); | |
10 | +$datay3=array(20,60,70); | |
11 | + | |
12 | +// Create the basic graph | |
13 | +$graph = new Graph(300,200); | |
14 | +$graph->clearTheme(); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMargin(40,20,20,40); | |
17 | +$graph->SetMarginColor('white:0.9'); | |
18 | +$graph->SetColor('white'); | |
19 | +$graph->SetShadow(); | |
20 | + | |
21 | +// Apply a perspective transformation at the end | |
22 | +$graph->Set3DPerspective(SKEW3D_DOWN,100,180); | |
23 | + | |
24 | +// Adjust the position of the legend box | |
25 | +$graph->legend->Pos(0.03,0.10); | |
26 | + | |
27 | +// Adjust the color for theshadow of the legend | |
28 | +$graph->legend->SetShadow('darkgray@0.5'); | |
29 | +$graph->legend->SetFillColor('lightblue@0.1'); | |
30 | +$graph->legend->Hide(); | |
31 | + | |
32 | +// Get localised version of the month names | |
33 | +$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); | |
34 | + | |
35 | +$graph->SetBackgroundCountryFlag('mais',BGIMG_COPY,50); | |
36 | + | |
37 | +// Set axis titles and fonts | |
38 | +$graph->xaxis->title->Set('Year 2002'); | |
39 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
40 | +$graph->xaxis->title->SetColor('white'); | |
41 | + | |
42 | +$graph->xaxis->SetFont(FF_FONT1,FS_BOLD); | |
43 | +$graph->xaxis->SetColor('navy'); | |
44 | + | |
45 | +$graph->yaxis->SetFont(FF_FONT1,FS_BOLD); | |
46 | +$graph->yaxis->SetColor('navy'); | |
47 | + | |
48 | +//$graph->ygrid->Show(false); | |
49 | +$graph->ygrid->SetColor('white@0.5'); | |
50 | + | |
51 | +// Setup graph title | |
52 | +$graph->title->Set('Using a country flag background'); | |
53 | + | |
54 | +// Some extra margin (from the top) | |
55 | +$graph->title->SetMargin(3); | |
56 | +$graph->title->SetFont(FF_ARIAL,FS_NORMAL,12); | |
57 | + | |
58 | +// Create the three var series we will combine | |
59 | +$bplot1 = new BarPlot($datay1); | |
60 | +$bplot2 = new BarPlot($datay2); | |
61 | +$bplot3 = new BarPlot($datay3); | |
62 | + | |
63 | +// Setup the colors with 40% transparency (alpha channel) | |
64 | +$bplot1->SetFillColor('yellow@0.4'); | |
65 | +$bplot2->SetFillColor('red@0.4'); | |
66 | +$bplot3->SetFillColor('darkgreen@0.4'); | |
67 | + | |
68 | +// Setup legends | |
69 | +$bplot1->SetLegend('Label 1'); | |
70 | +$bplot2->SetLegend('Label 2'); | |
71 | +$bplot3->SetLegend('Label 3'); | |
72 | + | |
73 | +// Setup each bar with a shadow of 50% transparency | |
74 | +$bplot1->SetShadow('black@0.4'); | |
75 | +$bplot2->SetShadow('black@0.4'); | |
76 | +$bplot3->SetShadow('black@0.4'); | |
77 | + | |
78 | +$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3)); | |
79 | +$gbarplot->SetWidth(0.6); | |
80 | +$graph->Add($gbarplot); | |
81 | + | |
82 | +$graph->Stroke(); | |
83 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,83 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | +require_once ('jpgraph/jpgraph_flags.php'); | |
6 | + | |
7 | +// Some data | |
8 | +$datay1=array(140,110,50); | |
9 | +$datay2=array(35,90,190); | |
10 | +$datay3=array(20,60,70); | |
11 | + | |
12 | +// Create the basic graph | |
13 | +$graph = new Graph(300,200); | |
14 | +$graph->clearTheme(); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMargin(40,20,20,40); | |
17 | +$graph->SetMarginColor('white:0.9'); | |
18 | +$graph->SetColor('white'); | |
19 | +$graph->SetShadow(); | |
20 | + | |
21 | +// Apply a perspective transformation at the end | |
22 | +$graph->Set3DPerspective(SKEW3D_LEFT,350,320,true); | |
23 | + | |
24 | +// Adjust the position of the legend box | |
25 | +$graph->legend->Pos(0.03,0.10); | |
26 | + | |
27 | +// Adjust the color for theshadow of the legend | |
28 | +$graph->legend->SetShadow('darkgray@0.5'); | |
29 | +$graph->legend->SetFillColor('lightblue@0.1'); | |
30 | +$graph->legend->Hide(); | |
31 | + | |
32 | +// Get localised version of the month names | |
33 | +$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); | |
34 | + | |
35 | +$graph->SetBackgroundCountryFlag('mais',BGIMG_COPY,50); | |
36 | + | |
37 | +// Set axis titles and fonts | |
38 | +$graph->xaxis->title->Set('Year 2002'); | |
39 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
40 | +$graph->xaxis->title->SetColor('white'); | |
41 | + | |
42 | +$graph->xaxis->SetFont(FF_FONT1,FS_BOLD); | |
43 | +$graph->xaxis->SetColor('navy'); | |
44 | + | |
45 | +$graph->yaxis->SetFont(FF_FONT1,FS_BOLD); | |
46 | +$graph->yaxis->SetColor('navy'); | |
47 | + | |
48 | +//$graph->ygrid->Show(false); | |
49 | +$graph->ygrid->SetColor('white@0.5'); | |
50 | + | |
51 | +// Setup graph title | |
52 | +$graph->title->Set('Using a country flag background'); | |
53 | + | |
54 | +// Some extra margin (from the top) | |
55 | +$graph->title->SetMargin(3); | |
56 | +$graph->title->SetFont(FF_ARIAL,FS_NORMAL,12); | |
57 | + | |
58 | +// Create the three var series we will combine | |
59 | +$bplot1 = new BarPlot($datay1); | |
60 | +$bplot2 = new BarPlot($datay2); | |
61 | +$bplot3 = new BarPlot($datay3); | |
62 | + | |
63 | +// Setup the colors with 40% transparency (alpha channel) | |
64 | +$bplot1->SetFillColor('yellow@0.4'); | |
65 | +$bplot2->SetFillColor('red@0.4'); | |
66 | +$bplot3->SetFillColor('darkgreen@0.4'); | |
67 | + | |
68 | +// Setup legends | |
69 | +$bplot1->SetLegend('Label 1'); | |
70 | +$bplot2->SetLegend('Label 2'); | |
71 | +$bplot3->SetLegend('Label 3'); | |
72 | + | |
73 | +// Setup each bar with a shadow of 50% transparency | |
74 | +$bplot1->SetShadow('black@0.4'); | |
75 | +$bplot2->SetShadow('black@0.4'); | |
76 | +$bplot3->SetShadow('black@0.4'); | |
77 | + | |
78 | +$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3)); | |
79 | +$gbarplot->SetWidth(0.6); | |
80 | +$graph->Add($gbarplot); | |
81 | + | |
82 | +$graph->Stroke(); | |
83 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,83 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | + | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_bar.php'); | |
5 | +require_once ('jpgraph/jpgraph_flags.php'); | |
6 | + | |
7 | +// Some data | |
8 | +$datay1=array(140,110,50); | |
9 | +$datay2=array(35,90,190); | |
10 | +$datay3=array(20,60,70); | |
11 | + | |
12 | +// Create the basic graph | |
13 | +$graph = new Graph(300,200); | |
14 | +$graph->clearTheme(); | |
15 | +$graph->SetScale("textlin"); | |
16 | +$graph->SetMargin(40,20,20,40); | |
17 | +$graph->SetMarginColor('white:0.9'); | |
18 | +$graph->SetColor('white'); | |
19 | +$graph->SetShadow(); | |
20 | + | |
21 | +// Apply a perspective transformation at the end | |
22 | +$graph->Set3DPerspective(SKEW3D_RIGHT,350,320,true); | |
23 | + | |
24 | +// Adjust the position of the legend box | |
25 | +$graph->legend->Pos(0.03,0.10); | |
26 | + | |
27 | +// Adjust the color for theshadow of the legend | |
28 | +$graph->legend->SetShadow('darkgray@0.5'); | |
29 | +$graph->legend->SetFillColor('lightblue@0.1'); | |
30 | +$graph->legend->Hide(); | |
31 | + | |
32 | +// Get localised version of the month names | |
33 | +$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); | |
34 | + | |
35 | +$graph->SetBackgroundCountryFlag('mais',BGIMG_COPY,50); | |
36 | + | |
37 | +// Set axis titles and fonts | |
38 | +$graph->xaxis->title->Set('Year 2002'); | |
39 | +$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); | |
40 | +$graph->xaxis->title->SetColor('white'); | |
41 | + | |
42 | +$graph->xaxis->SetFont(FF_FONT1,FS_BOLD); | |
43 | +$graph->xaxis->SetColor('navy'); | |
44 | + | |
45 | +$graph->yaxis->SetFont(FF_FONT1,FS_BOLD); | |
46 | +$graph->yaxis->SetColor('navy'); | |
47 | + | |
48 | +//$graph->ygrid->Show(false); | |
49 | +$graph->ygrid->SetColor('white@0.5'); | |
50 | + | |
51 | +// Setup graph title | |
52 | +$graph->title->Set('Using a country flag background'); | |
53 | + | |
54 | +// Some extra margin (from the top) | |
55 | +$graph->title->SetMargin(3); | |
56 | +$graph->title->SetFont(FF_ARIAL,FS_NORMAL,12); | |
57 | + | |
58 | +// Create the three var series we will combine | |
59 | +$bplot1 = new BarPlot($datay1); | |
60 | +$bplot2 = new BarPlot($datay2); | |
61 | +$bplot3 = new BarPlot($datay3); | |
62 | + | |
63 | +// Setup the colors with 40% transparency (alpha channel) | |
64 | +$bplot1->SetFillColor('yellow@0.4'); | |
65 | +$bplot2->SetFillColor('red@0.4'); | |
66 | +$bplot3->SetFillColor('darkgreen@0.4'); | |
67 | + | |
68 | +// Setup legends | |
69 | +$bplot1->SetLegend('Label 1'); | |
70 | +$bplot2->SetLegend('Label 2'); | |
71 | +$bplot3->SetLegend('Label 3'); | |
72 | + | |
73 | +// Setup each bar with a shadow of 50% transparency | |
74 | +$bplot1->SetShadow('black@0.4'); | |
75 | +$bplot2->SetShadow('black@0.4'); | |
76 | +$bplot3->SetShadow('black@0.4'); | |
77 | + | |
78 | +$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3)); | |
79 | +$gbarplot->SetWidth(0.6); | |
80 | +$graph->Add($gbarplot); | |
81 | + | |
82 | +$graph->Stroke(); | |
83 | +?> | |
... | ... |
1.14 KB
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example of a stock chart | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_stock.php'); | |
5 | + | |
6 | +// Data must be in the format : open,close,min,max,median | |
7 | +$datay = array( | |
8 | + 34,42,27,45,36, | |
9 | + 55,25,14,59,40, | |
10 | + 15,40,12,47,23, | |
11 | + 62,38,25,65,57, | |
12 | + 38,49,32,64,45); | |
13 | + | |
14 | +// Setup a simple graph | |
15 | +$graph = new Graph(300,200); | |
16 | +$graph->SetScale("textlin"); | |
17 | +$graph->SetMarginColor('lightblue'); | |
18 | +$graph->title->Set('Box Stock chart example'); | |
19 | + | |
20 | +// Create a new stock plot | |
21 | +$p1 = new BoxPlot($datay); | |
22 | + | |
23 | +// Setup URL target for image map | |
24 | +$p1->SetCSIMTargets(array('#1','#2','#3','#4','#5')); | |
25 | + | |
26 | +// Width of the bars (in pixels) | |
27 | +$p1->SetWidth(9); | |
28 | + | |
29 | +//$p1->SetCenter(); | |
30 | +// Uncomment the following line to hide the horizontal end lines | |
31 | +//$p1->HideEndLines(); | |
32 | + | |
33 | +// Add the plot to the graph and send it back to the browser | |
34 | +$graph->Add($p1); | |
35 | +$graph->StrokeCSIM(); | |
36 | + | |
37 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example of a stock chart | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_stock.php'); | |
5 | + | |
6 | +// Data must be in the format : open,close,min,max,median | |
7 | +$datay = array( | |
8 | + 34,42,27,45,36, | |
9 | + 55,25,14,59,40, | |
10 | + 15,40,12,47,23, | |
11 | + 62,38,25,65,57, | |
12 | + 38,49,32,64,45); | |
13 | + | |
14 | +// Setup a simple graph | |
15 | +$graph = new Graph(300,200); | |
16 | +$graph->clearTheme(); | |
17 | +$graph->SetScale('textlin'); | |
18 | +$graph->SetMarginColor('lightblue'); | |
19 | +$graph->title->Set('Box Stock chart example'); | |
20 | + | |
21 | +// Create a new stock plot | |
22 | +$p1 = new BoxPlot($datay); | |
23 | + | |
24 | +// Width of the bars (in pixels) | |
25 | +$p1->SetWidth(9); | |
26 | + | |
27 | +// Uncomment the following line to hide the horizontal end lines | |
28 | +//$p1->HideEndLines(); | |
29 | + | |
30 | +// Add the plot to the graph and send it back to the browser | |
31 | +$graph->Add($p1); | |
32 | +$graph->Stroke(); | |
33 | + | |
34 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// Example of a stock chart | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_stock.php'); | |
5 | + | |
6 | +// Data must be in the format : open,close,min,max,median | |
7 | +$datay = array( | |
8 | + 34,42,27,45,36, | |
9 | + 55,25,14,59,40, | |
10 | + 15,40,12,47,23, | |
11 | + 62,38,25,65,57, | |
12 | + 38,49,32,64,45); | |
13 | + | |
14 | +// Setup a simple graph | |
15 | +$graph = new Graph(300,200); | |
16 | +$graph->clearTheme(); | |
17 | +$graph->SetScale("textlin"); | |
18 | +$graph->SetMarginColor('lightblue'); | |
19 | +$graph->title->Set('Box Stock chart example'); | |
20 | +$graph->subtitle->Set('(Indented X-axis)'); | |
21 | + | |
22 | +// Create a new stock plot | |
23 | +$p1 = new BoxPlot($datay); | |
24 | + | |
25 | +// Width of the bars (in pixels) | |
26 | +$p1->SetWidth(9); | |
27 | + | |
28 | +// Indent bars so they dont start and end at the edge of the | |
29 | +// plot area | |
30 | +$p1->SetCenter(); | |
31 | + | |
32 | +// Uncomment the following line to hide the horizontal end lines | |
33 | +//$p1->HideEndLines(); | |
34 | + | |
35 | +// Add the plot to the graph and send it back to the browser | |
36 | +$graph->Add($p1); | |
37 | +$graph->Stroke(); | |
38 | + | |
39 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,66 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | +require_once ('jpgraph/jpgraph_plotline.php'); | |
5 | + | |
6 | +$datay1 = array(2,6,7,12,13,18); | |
7 | +$datay2 = array(5,12,12,19,25,20); | |
8 | + | |
9 | +// Setup the graph | |
10 | +$graph = new Graph(350,200); | |
11 | +$graph->SetMargin(30,20,60,20); | |
12 | +$graph->SetMarginColor('white'); | |
13 | +$graph->SetScale("linlin"); | |
14 | + | |
15 | +// Hide the frame around the graph | |
16 | +$graph->SetFrame(false); | |
17 | + | |
18 | +// Setup title | |
19 | +$graph->title->Set("Using Builtin PlotMarks"); | |
20 | +$graph->title->SetFont(FF_VERDANA,FS_BOLD,14); | |
21 | + | |
22 | +// Note: requires jpgraph 1.12p or higher | |
23 | +// $graph->SetBackgroundGradient('blue','navy:0.5',GRAD_HOR,BGRAD_PLOT); | |
24 | +$graph->tabtitle->Set('Region 1' ); | |
25 | +$graph->tabtitle->SetWidth(TABTITLE_WIDTHFULL); | |
26 | + | |
27 | +// Enable X and Y Grid | |
28 | +$graph->xgrid->Show(); | |
29 | +$graph->xgrid->SetColor('gray@0.5'); | |
30 | +$graph->ygrid->SetColor('gray@0.5'); | |
31 | + | |
32 | +// Format the legend box | |
33 | +$graph->legend->SetColor('navy'); | |
34 | +$graph->legend->SetFillColor('lightgreen'); | |
35 | +$graph->legend->SetLineWeight(1); | |
36 | +$graph->legend->SetFont(FF_ARIAL,FS_BOLD,8); | |
37 | +$graph->legend->SetShadow('gray@0.4',3); | |
38 | +$graph->legend->SetAbsPos(15,120,'right','bottom'); | |
39 | + | |
40 | +// Create the line plots | |
41 | + | |
42 | +$p1 = new LinePlot($datay1); | |
43 | +$p1->SetColor("red"); | |
44 | +$p1->SetFillColor("yellow@0.5"); | |
45 | +$p1->SetWeight(2); | |
46 | +$p1->mark->SetType(MARK_IMG_DIAMOND,5,0.6); | |
47 | +$p1->SetLegend('2006'); | |
48 | +$graph->Add($p1); | |
49 | + | |
50 | +$p2 = new LinePlot($datay2); | |
51 | +$p2->SetColor("darkgreen"); | |
52 | +$p2->SetWeight(2); | |
53 | +$p2->SetLegend('2001'); | |
54 | +$p2->mark->SetType(MARK_IMG_MBALL,'red'); | |
55 | +$graph->Add($p2); | |
56 | + | |
57 | +// Add a vertical line at the end scale position '7' | |
58 | +$l1 = new PlotLine(VERTICAL,7); | |
59 | +$graph->Add($l1); | |
60 | + | |
61 | +// Output the graph | |
62 | +$graph->Stroke(); | |
63 | + | |
64 | +?> | |
65 | + | |
66 | + | |
... | ... |
... | ... | @@ -0,0 +1,143 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvas_jpgarchex.php,v 1.3 2002/08/29 10:14:19 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | +require_once ('jpgraph/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 | + | |
... | ... |
... | ... | @@ -0,0 +1,40 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvasbezierex1.php,v 1.1 2002/10/05 21:04:28 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | +require_once ('jpgraph/jpgraph_canvtools.php'); | |
6 | + | |
7 | +// Setup canvas graph | |
8 | +$g = new CanvasGraph(400,300); | |
9 | +$scale = new CanvasScale($g); | |
10 | +$shape = new Shape($g,$scale); | |
11 | + | |
12 | +$g->title->Set('Bezier line with control points'); | |
13 | + | |
14 | +// Setup control point for bezier | |
15 | +$p = array(3,6, | |
16 | + 6,9, | |
17 | + 5,3, | |
18 | + 7,4); | |
19 | + | |
20 | +// Visualize control points | |
21 | +$shape->SetColor('blue'); | |
22 | +$shape->Line($p[0],$p[1],$p[2],$p[3]); | |
23 | +$shape->FilledCircle($p[2],$p[3],-6); | |
24 | + | |
25 | +$shape->SetColor('red'); | |
26 | +$shape->Line($p[4],$p[5],$p[6],$p[7]); | |
27 | +$shape->FilledCircle($p[4],$p[5],-6); | |
28 | + | |
29 | +// Draw bezier | |
30 | +$shape->SetColor('black'); | |
31 | +$shape->Bezier($p); | |
32 | + | |
33 | +// Frame it with a square | |
34 | +$shape->SetColor('navy'); | |
35 | +$shape->Rectangle(0.5,2,9.5,9.5); | |
36 | + | |
37 | +// ... and stroke it | |
38 | +$g->Stroke(); | |
39 | +?> | |
40 | + | |
... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvasex01.php,v 1.3 2002/10/23 08:17:23 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | + | |
6 | +// Setup a basic canvas we can work | |
7 | +$g = new CanvasGraph(400,300,'auto'); | |
8 | +$g->SetMargin(5,11,6,11); | |
9 | +$g->SetShadow(); | |
10 | +$g->SetMarginColor("teal"); | |
11 | + | |
12 | +// We need to stroke the plotarea and margin before we add the | |
13 | +// text since we otherwise would overwrite the text. | |
14 | +$g->InitFrame(); | |
15 | + | |
16 | +// Draw a text box in the middle | |
17 | +$txt="This\nis\na TEXT!!!"; | |
18 | +$t = new Text($txt,200,10); | |
19 | +$t->SetFont(FF_ARIAL,FS_BOLD,40); | |
20 | + | |
21 | +// How should the text box interpret the coordinates? | |
22 | +$t->Align('center','top'); | |
23 | + | |
24 | +// How should the paragraph be aligned? | |
25 | +$t->ParagraphAlign('center'); | |
26 | + | |
27 | +// Add a box around the text, white fill, black border and gray shadow | |
28 | +$t->SetBox("white","black","gray"); | |
29 | + | |
30 | +// Stroke the text | |
31 | +$t->Stroke($g->img); | |
32 | + | |
33 | +// Stroke the graph | |
34 | +$g->Stroke(); | |
35 | + | |
36 | +?> | |
37 | + | |
... | ... |
... | ... | @@ -0,0 +1,42 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvasex02.php,v 1.1 2002/08/27 20:08:57 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | + | |
6 | +// Setup a basic canvas we can work | |
7 | +$g = new CanvasGraph(400,200,'auto'); | |
8 | +$g->SetMargin(5,11,6,11); | |
9 | +$g->SetShadow(); | |
10 | +$g->SetMarginColor("teal"); | |
11 | + | |
12 | +// We need to stroke the plotarea and margin before we add the | |
13 | +// text since we otherwise would overwrite the text. | |
14 | +$g->InitFrame(); | |
15 | + | |
16 | +// Add a black line | |
17 | +$g->img->SetColor('black'); | |
18 | +$g->img->Line(0,0,100,100); | |
19 | + | |
20 | +// .. and a circle (x,y,diameter) | |
21 | +$g->img->Circle(100,100,50); | |
22 | + | |
23 | +// .. and a filled circle (x,y,diameter) | |
24 | +$g->img->SetColor('red'); | |
25 | +$g->img->FilledCircle(200,100,50); | |
26 | + | |
27 | +// .. add a rectangle | |
28 | +$g->img->SetColor('green'); | |
29 | +$g->img->FilledRectangle(10,10,50,50); | |
30 | + | |
31 | +// .. add a filled rounded rectangle | |
32 | +$g->img->SetColor('green'); | |
33 | +$g->img->FilledRoundedRectangle(300,30,350,80,10); | |
34 | +// .. with a darker border | |
35 | +$g->img->SetColor('darkgreen'); | |
36 | +$g->img->RoundedRectangle(300,30,350,80,10); | |
37 | + | |
38 | +// Stroke the graph | |
39 | +$g->Stroke(); | |
40 | + | |
41 | +?> | |
42 | + | |
... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvasex03.php,v 1.1 2002/08/27 20:08:57 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | +require_once ('jpgraph/jpgraph_canvtools.php'); | |
6 | + | |
7 | +// Define work space | |
8 | +$xmax=20; | |
9 | +$ymax=20; | |
10 | + | |
11 | +// Setup a basic canvas we can work | |
12 | +$g = new CanvasGraph(400,200,'auto'); | |
13 | +$g->SetMargin(5,11,6,11); | |
14 | +$g->SetShadow(); | |
15 | +$g->SetMarginColor("teal"); | |
16 | + | |
17 | +// We need to stroke the plotarea and margin before we add the | |
18 | +// text since we otherwise would overwrite the text. | |
19 | +$g->InitFrame(); | |
20 | + | |
21 | +// Create a new scale | |
22 | +$scale = new CanvasScale($g); | |
23 | +$scale->Set(0,$xmax,0,$ymax); | |
24 | + | |
25 | +// The shape class is wrapper around the Imgae class which translates | |
26 | +// the coordinates for us | |
27 | +$shape = new Shape($g,$scale); | |
28 | +$shape->SetColor('black'); | |
29 | + | |
30 | + | |
31 | +// Add a black line | |
32 | +$shape->SetColor('black'); | |
33 | +$shape->Line(0,0,20,20); | |
34 | + | |
35 | +// .. and a circle (x,y,diameter) | |
36 | +$shape->Circle(5,14,2); | |
37 | + | |
38 | +// .. and a filled circle (x,y,diameter) | |
39 | +$shape->SetColor('red'); | |
40 | +$shape->FilledCircle(11,8,3); | |
41 | + | |
42 | +// .. add a rectangle | |
43 | +$shape->SetColor('green'); | |
44 | +$shape->FilledRectangle(15,8,19,14); | |
45 | + | |
46 | +// .. add a filled rounded rectangle | |
47 | +$shape->SetColor('green'); | |
48 | +$shape->FilledRoundedRectangle(2,3,8,6); | |
49 | +// .. with a darker border | |
50 | +$shape->SetColor('darkgreen'); | |
51 | +$shape->RoundedRectangle(2,3,8,6); | |
52 | + | |
53 | + | |
54 | +// Stroke the graph | |
55 | +$g->Stroke(); | |
56 | + | |
57 | +?> | |
58 | + | |
... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvasex04.php,v 1.1 2002/08/27 20:08:57 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | +require_once ('jpgraph/jpgraph_canvtools.php'); | |
6 | + | |
7 | +// Define work space | |
8 | +$xmax=20; | |
9 | +$ymax=20; | |
10 | + | |
11 | +// Setup a basic canvas we can work | |
12 | +$g = new CanvasGraph(200,100,'auto'); | |
13 | +$g->SetMargin(5,11,6,11); | |
14 | +$g->SetShadow(); | |
15 | +$g->SetMarginColor("teal"); | |
16 | + | |
17 | +// We need to stroke the plotarea and margin before we add the | |
18 | +// text since we otherwise would overwrite the text. | |
19 | +$g->InitFrame(); | |
20 | + | |
21 | +// Create a new scale | |
22 | +$scale = new CanvasScale($g); | |
23 | +$scale->Set(0,$xmax,0,$ymax); | |
24 | + | |
25 | +// The shape class is wrapper around the Imgae class which translates | |
26 | +// the coordinates for us | |
27 | +$shape = new Shape($g,$scale); | |
28 | +$shape->SetColor('black'); | |
29 | + | |
30 | + | |
31 | +// Add a black line | |
32 | +$shape->SetColor('black'); | |
33 | +$shape->Line(0,0,20,20); | |
34 | + | |
35 | +// .. and a circle (x,y,diameter) | |
36 | +$shape->Circle(5,14,2); | |
37 | + | |
38 | +// .. and a filled circle (x,y,diameter) | |
39 | +$shape->SetColor('red'); | |
40 | +$shape->FilledCircle(11,8,3); | |
41 | + | |
42 | +// .. add a rectangle | |
43 | +$shape->SetColor('green'); | |
44 | +$shape->FilledRectangle(15,8,19,14); | |
45 | + | |
46 | +// .. add a filled rounded rectangle | |
47 | +$shape->SetColor('green'); | |
48 | +$shape->FilledRoundedRectangle(2,3,8,6); | |
49 | +// .. with a darker border | |
50 | +$shape->SetColor('darkgreen'); | |
51 | +$shape->RoundedRectangle(2,3,8,6); | |
52 | + | |
53 | + | |
54 | +// Stroke the graph | |
55 | +$g->Stroke(); | |
56 | + | |
57 | +?> | |
58 | + | |
... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvasex05.php,v 1.1 2002/08/27 20:08:57 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | +require_once ('jpgraph/jpgraph_canvtools.php'); | |
6 | + | |
7 | +// Define work space | |
8 | +$xmax=40; | |
9 | +$ymax=40; | |
10 | + | |
11 | +// Setup a basic canvas we can work | |
12 | +$g = new CanvasGraph(400,200,'auto'); | |
13 | +$g->SetMargin(5,11,6,11); | |
14 | +$g->SetShadow(); | |
15 | +$g->SetMarginColor("teal"); | |
16 | + | |
17 | +// We need to stroke the plotarea and margin before we add the | |
18 | +// text since we otherwise would overwrite the text. | |
19 | +$g->InitFrame(); | |
20 | + | |
21 | +// Create a new scale | |
22 | +$scale = new CanvasScale($g); | |
23 | +$scale->Set(0,$xmax,0,$ymax); | |
24 | + | |
25 | +// The shape class is wrapper around the Imgae class which translates | |
26 | +// the coordinates for us | |
27 | +$shape = new Shape($g,$scale); | |
28 | +$shape->SetColor('black'); | |
29 | + | |
30 | + | |
31 | +// Add a black line | |
32 | +$shape->SetColor('black'); | |
33 | +$shape->Line(0,0,20,20); | |
34 | + | |
35 | +// .. and a circle (x,y,diameter) | |
36 | +$shape->Circle(5,14,2); | |
37 | + | |
38 | +// .. and a filled circle (x,y,diameter) | |
39 | +$shape->SetColor('red'); | |
40 | +$shape->FilledCircle(11,8,3); | |
41 | + | |
42 | +// .. add a rectangle | |
43 | +$shape->SetColor('green'); | |
44 | +$shape->FilledRectangle(15,8,19,14); | |
45 | + | |
46 | +// .. add a filled rounded rectangle | |
47 | +$shape->SetColor('green'); | |
48 | +$shape->FilledRoundedRectangle(2,3,8,6); | |
49 | +// .. with a darker border | |
50 | +$shape->SetColor('darkgreen'); | |
51 | +$shape->RoundedRectangle(2,3,8,6); | |
52 | + | |
53 | + | |
54 | +// Stroke the graph | |
55 | +$g->Stroke(); | |
56 | + | |
57 | +?> | |
58 | + | |
... | ... |
... | ... | @@ -0,0 +1,42 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvasex06.php,v 1.1 2002/08/27 20:08:57 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | +require_once ('jpgraph/jpgraph_canvtools.php'); | |
6 | + | |
7 | +// Define work space | |
8 | +$xmax=40; | |
9 | +$ymax=40; | |
10 | + | |
11 | +// Setup a basic canvas we can work | |
12 | +$g = new CanvasGraph(400,200,'auto'); | |
13 | +$g->SetMargin(5,11,6,11); | |
14 | +$g->SetShadow(); | |
15 | +$g->SetMarginColor("teal"); | |
16 | + | |
17 | +// We need to stroke the plotarea and margin before we add the | |
18 | +// text since we otherwise would overwrite the text. | |
19 | +$g->InitFrame(); | |
20 | + | |
21 | +// Create a new scale | |
22 | +$scale = new CanvasScale($g); | |
23 | +$scale->Set(0,$xmax,0,$ymax); | |
24 | + | |
25 | +// The shape class is wrapper around the Imgae class which translates | |
26 | +// the coordinates for us | |
27 | +$shape = new Shape($g,$scale); | |
28 | +$shape->SetColor('black'); | |
29 | + | |
30 | +$shape->IndentedRectangle(1,2,15,15,8,8,CORNER_TOPLEFT,'khaki'); | |
31 | + | |
32 | +$shape->IndentedRectangle(1,20,15,15,8,8,CORNER_BOTTOMLEFT,'khaki'); | |
33 | + | |
34 | +$shape->IndentedRectangle(20,2,15,15,8,8,CORNER_TOPRIGHT,'khaki'); | |
35 | + | |
36 | +$shape->IndentedRectangle(20,20,15,15,8,8,CORNER_BOTTOMRIGHT,'khaki'); | |
37 | + | |
38 | +// Stroke the graph | |
39 | +$g->Stroke(); | |
40 | + | |
41 | +?> | |
42 | + | |
... | ... |
... | ... | @@ -0,0 +1,78 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +// $Id: canvaspiralex1.php,v 1.1 2002/10/26 11:35:42 aditus Exp $ | |
3 | +require_once ('jpgraph/jpgraph.php'); | |
4 | +require_once ('jpgraph/jpgraph_canvas.php'); | |
5 | + | |
6 | + | |
7 | +if( empty($_GET['r']) ) | |
8 | + $r = 0.44; | |
9 | +else | |
10 | + $r = $_GET['r']; | |
11 | + | |
12 | +if( empty($_GET['w']) ) | |
13 | + $w=150; | |
14 | +else | |
15 | + $w = $_GET['w']; | |
16 | + | |
17 | +if( empty($_GET['h']) ) | |
18 | + $h=240; | |
19 | +else | |
20 | + $h = $_GET['h']; | |
21 | + | |
22 | +if( $w < 60 ) $w=60; | |
23 | +if( $h < 60 ) $h=60; | |
24 | + | |
25 | + | |
26 | +function SeaShell($img,$x,$y,$w,$h,$r,$n=12,$color1='navy',$color2='red') { | |
27 | + | |
28 | + $x += $w; | |
29 | + $w = (1-$r)/$r*$w; | |
30 | + | |
31 | + $sa = 0; | |
32 | + $ea = 90; | |
33 | + | |
34 | + $s1 = 1; | |
35 | + $s2 = -1; | |
36 | + $x_old=$x; $y_old=$y; | |
37 | + for($i=1; $i < $n; ++$i) { | |
38 | + $sa += 90; | |
39 | + $ea += 90; | |
40 | + if( $i % 2 == 1 ) { | |
41 | + $y = $y + $s1*$h*$r; | |
42 | + $h = (1-$r)*$h; | |
43 | + $w = $w / (1-$r) * $r ; | |
44 | + $s1 *= -1; | |
45 | + $img->SetColor($color1); | |
46 | + $img->Line($x,$y,$x+$s1*$w,$y); | |
47 | + } | |
48 | + else { | |
49 | + $x = $x + $s2*$w*$r; | |
50 | + $w = (1-$r)*$w; | |
51 | + $h = $h / (1-$r) * $r; | |
52 | + $s2 *= -1; | |
53 | + $img->SetColor($color1); | |
54 | + $img->Line($x,$y,$x,$y-$s2*$h); | |
55 | + } | |
56 | + $img->SetColor($color2); | |
57 | + $img->FilledRectangle($x-1,$y-1,$x+1,$y+1); | |
58 | + $img->Arc($x,$y,2*$w+1,2*$h+1,$sa,$ea); | |
59 | + $img->Arc($x,$y,2*$w,2*$h,$sa,$ea); | |
60 | + $img->Arc($x,$y,2*$w-1,2*$h-1,$sa,$ea); | |
61 | + $img->Line($x_old,$y_old,$x,$y); | |
62 | + $x_old=$x; $y_old=$y; | |
63 | + } | |
64 | +} | |
65 | + | |
66 | +$g = new CanvasGraph($w,$h); | |
67 | +//$gr = 1.61803398874989484820; | |
68 | + | |
69 | +$p = SeaShell($g->img,0,20,$w-1,$h-21,$r,19); | |
70 | +$g->img->SetColor('black'); | |
71 | +$g->img->Rectangle(0,20,$w-1,$h-1); | |
72 | +$g->img->SetFont(FF_FONT2,FS_BOLD); | |
73 | +$g->img->SetTextAlign('center','top'); | |
74 | +$g->img->StrokeText($w/2,0,"Canvas Spiral"); | |
75 | + | |
76 | +$g->Stroke(); | |
77 | +?> | |
78 | + | |
... | ... |
... | ... | @@ -0,0 +1,36 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once 'jpgraph/jpgraph.php'; | |
3 | +require_once 'jpgraph/jpgraph_line.php'; | |
4 | +require_once 'jpgraph/jpgraph_plotmark.inc.php'; | |
5 | +require_once 'jpgraph/jpgraph_scatter.php'; | |
6 | +require_once 'ccbpgraph.class.php'; | |
7 | + | |
8 | +$graph = new CCBPGraph(600,400); | |
9 | +$graph->SetTitle('Buffer penetration','(history added)'); | |
10 | +$graph->SetColorMap(0); | |
11 | + | |
12 | + // Two "fake tasks with hostory | |
13 | +$datax=array(75,83); $datay=array(110,64); | |
14 | +$datax1 = array(33,50,67,83); $datay1 = array(86,76,80,64); | |
15 | +$datax2 = array(18,47,58,75); $datay2 = array(80,97,105,110); | |
16 | + | |
17 | +$sp = new ScatterPlot($datay,$datax); | |
18 | +$sp->mark->SetType(MARK_DIAMOND); | |
19 | +$sp->mark->SetFillColor('white'); | |
20 | +$sp->mark->SetSize(12); | |
21 | + | |
22 | +$sp_hist = array(); | |
23 | +$sp_hist[0] = new LinePlot($datay1,$datax1); | |
24 | +$sp_hist[0]->SetWeight(1); | |
25 | +$sp_hist[0]->SetColor('white'); | |
26 | + | |
27 | +$sp_hist[1] = new LinePlot($datay2,$datax2); | |
28 | +$sp_hist[1]->SetWeight(1); | |
29 | +$sp_hist[1]->SetColor('white'); | |
30 | + | |
31 | +$graph->Add($sp_hist); | |
32 | +$graph->Add($sp); | |
33 | + | |
34 | +$graph->Stroke(); | |
35 | + | |
36 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,36 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once 'jpgraph/jpgraph.php'; | |
3 | +require_once 'jpgraph/jpgraph_line.php'; | |
4 | +require_once 'jpgraph/jpgraph_plotmark.inc.php'; | |
5 | +require_once 'jpgraph/jpgraph_scatter.php'; | |
6 | +require_once 'ccbpgraph.class.php'; | |
7 | + | |
8 | +$graph = new CCBPGraph(600,400); | |
9 | +$graph->SetTitle('Buffer penetration','(history added)'); | |
10 | +$graph->SetColorMap(1); | |
11 | + | |
12 | + // Two "fake tasks with hostory | |
13 | +$datax=array(75,83); $datay=array(110,64); | |
14 | +$datax1 = array(33,50,67,83); $datay1 = array(86,76,80,64); | |
15 | +$datax2 = array(18,47,58,75); $datay2 = array(80,97,105,110); | |
16 | + | |
17 | +$sp = new ScatterPlot($datay,$datax); | |
18 | +$sp->mark->SetType(MARK_DIAMOND); | |
19 | +$sp->mark->SetFillColor('white'); | |
20 | +$sp->mark->SetSize(12); | |
21 | + | |
22 | +$sp_hist = array(); | |
23 | +$sp_hist[0] = new LinePlot($datay1,$datax1); | |
24 | +$sp_hist[0]->SetWeight(1); | |
25 | +$sp_hist[0]->SetColor('white'); | |
26 | + | |
27 | +$sp_hist[1] = new LinePlot($datay2,$datax2); | |
28 | +$sp_hist[1]->SetWeight(1); | |
29 | +$sp_hist[1]->SetColor('white'); | |
30 | + | |
31 | +$graph->Add($sp_hist); | |
32 | +$graph->Add($sp); | |
33 | + | |
34 | +$graph->Stroke(); | |
35 | + | |
36 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,258 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +/** | |
3 | +* Class CCBPGraph | |
4 | +* Utility class to create Critical Chain Buffer penetration charts | |
5 | +*/ | |
6 | +class CCBPGraph { | |
7 | + const TickStep = 25; | |
8 | + const YTitle = '% Buffer used'; | |
9 | + const XTitle = '% CC Completed'; | |
10 | + const NColorMaps = 2; | |
11 | + private $graph=null; | |
12 | + private $iWidth,$iHeight; | |
13 | + private $iPlots=array(); | |
14 | + private $iXMin=-50, $iXMax = 100; | |
15 | + private $iYMin=-50, $iYMax = 150; | |
16 | + private $iColorInd = array( | |
17 | + array(5,75), /* Green */ | |
18 | + array(25,85), /* Yellow */ | |
19 | + array(50,100));/* Red */ | |
20 | + private $iColorMap = 0; | |
21 | + private $iColorSpec = array( | |
22 | + array('darkgreen:1.0','yellow:1.4','red:0.8','darkred:0.85'), | |
23 | + array('#c6e9af','#ffeeaa','#ffaaaa','#de8787')); | |
24 | + private $iMarginColor = array('darkgreen@0.7','darkgreen@0.9'); | |
25 | + private $iSubTitle='',$iTitle = 'CC Buffer penetration'; | |
26 | + /** | |
27 | + * Construct a new instance of CCBPGraph | |
28 | + * | |
29 | + * @param int $aWidth | |
30 | + * @param int $aHeight | |
31 | + * @return CCBPGraph | |
32 | + */ | |
33 | + public function __construct($aWidth, $aHeight) { | |
34 | + $this->iWidth = $aWidth; | |
35 | + $this->iHeight = $aHeight; | |
36 | + } | |
37 | + /** | |
38 | + * Set the title and subtitle for the graph | |
39 | + * | |
40 | + * @param string $aTitle | |
41 | + * @param string $aSubTitle | |
42 | + */ | |
43 | + public function SetTitle($aTitle, $aSubTitle) { | |
44 | + $this->iTitle = $aTitle; | |
45 | + $this->iSubTitle = $aSubTitle; | |
46 | + } | |
47 | + /** | |
48 | + * Set the x-axis min and max values | |
49 | + * | |
50 | + * @param int $aMin | |
51 | + * @param int $aMax | |
52 | + */ | |
53 | + public function SetXMinMax($aMin, $aMax) { | |
54 | + $this->iXMin = floor($aMin/CCBPGraph::TickStep)*CCBPGraph::TickStep; | |
55 | + $this->iXMax = ceil($aMax/CCBPGraph::TickStep)*CCBPGraph::TickStep; | |
56 | + } | |
57 | + /** | |
58 | + * Specify what color map to use | |
59 | + * | |
60 | + * @param int $aMap | |
61 | + */ | |
62 | + public function SetColorMap($aMap) { | |
63 | + $this->iColorMap = $aMap % CCBPGraph::NColorMaps; | |
64 | + } | |
65 | + /** | |
66 | + * Set the y-axis min and max values | |
67 | + * | |
68 | + * @param int $aMin | |
69 | + * @param int $aMax | |
70 | + */ | |
71 | + public function SetYMinMax($aMin,$aMax) { | |
72 | + $this->iYMin = floor($aMin/CCBPGraph::TickStep)*CCBPGraph::TickStep; | |
73 | + $this->iYMax = ceil($aMax/CCBPGraph::TickStep)*CCBPGraph::TickStep; | |
74 | + } | |
75 | + /** | |
76 | + * Set the specification of the color backgrounds and also the | |
77 | + * optional exact colors to be used | |
78 | + * | |
79 | + * @param mixed $aSpec An array of 3 1x2 arrays. Each array specify the | |
80 | + * color indication value at x=0 and x=max x in order to determine the slope | |
81 | + * @param mixed $aColors An array with four elements specifying the colors | |
82 | + * of each color indicator | |
83 | + */ | |
84 | + public function SetColorIndication(array $aSpec,array $aColors=null) { | |
85 | + if( count($aSpec) !== 3 ) { | |
86 | + JpgraphError::Raise('Specification of scale values for background indicators must be an array with three elements.'); | |
87 | + } | |
88 | + $this->iColorInd = $aSpec; | |
89 | + if( $aColors !== null ) { | |
90 | + if( is_array($aColors) && count($aColors) == 4 ) { | |
91 | + $this->iColorSpec = $aColors; | |
92 | + } | |
93 | + else { | |
94 | + JpGraphError::Raise('Color specification for background indication must have four colors.'); | |
95 | + } | |
96 | + } | |
97 | + } | |
98 | + /** | |
99 | + * Construct the graph | |
100 | + * | |
101 | + */ | |
102 | + private function Init() { | |
103 | + | |
104 | + // Setup limits for color indications | |
105 | + $lowx = $this->iXMin; $highx= $this->iXMax; | |
106 | + $lowy = $this->iYMin; $highy = $this->iYMax; | |
107 | + $width=$this->iWidth; $height=$this->iHeight; | |
108 | + | |
109 | + // Margins | |
110 | + $lm=50; $rm=40; | |
111 | + $tm=60; $bm=40; | |
112 | + | |
113 | + if( $width <= 300 || $height <= 250 ) { | |
114 | + $labelsize = 8; | |
115 | + $lm=25; $rm=25; | |
116 | + $tm=45; $bm=25; | |
117 | + } | |
118 | + elseif( $width <= 450 || $height <= 300 ) { | |
119 | + $labelsize = 8; | |
120 | + $lm=30; $rm=30; | |
121 | + $tm=50; $bm=30; | |
122 | + } | |
123 | + elseif( $width <= 600 || $height <= 400 ) { | |
124 | + $labelsize = 9; | |
125 | + } | |
126 | + else { | |
127 | + $labelsize = 11; | |
128 | + } | |
129 | + | |
130 | + if( $this->iSubTitle == '' ) { | |
131 | + $tm -= $labelsize+4; | |
132 | + } | |
133 | + | |
134 | + $graph = new Graph($width,$height); | |
135 | + $graph->clearTheme(); | |
136 | + $graph->SetScale('intint',$lowy,$highy,$lowx,$highx); | |
137 | + $graph->SetMargin($lm,$rm,$tm,$bm); | |
138 | + $graph->SetMarginColor($this->iMarginColor[$this->iColorMap]); | |
139 | + $graph->SetClipping(); | |
140 | + | |
141 | + $graph->title->Set($this->iTitle); | |
142 | + $graph->subtitle->Set($this->iSubTitle); | |
143 | + | |
144 | + $graph->title->SetFont(FF_ARIAL,FS_BOLD,$labelsize+4); | |
145 | + $graph->subtitle->SetFont(FF_ARIAL,FS_BOLD,$labelsize+1); | |
146 | + | |
147 | + $graph->SetBox(true,'black@0.3'); | |
148 | + | |
149 | + $graph->xaxis->SetFont(FF_ARIAL,FS_BOLD,$labelsize); | |
150 | + $graph->yaxis->SetFont(FF_ARIAL,FS_BOLD,$labelsize); | |
151 | + | |
152 | + $graph->xaxis->scale->ticks->Set(CCBPGraph::TickStep,CCBPGraph::TickStep); | |
153 | + $graph->yaxis->scale->ticks->Set(CCBPGraph::TickStep,CCBPGraph::TickStep); | |
154 | + | |
155 | + $graph->xaxis->HideZeroLabel(); | |
156 | + $graph->yaxis->HideZeroLabel(); | |
157 | + | |
158 | + $graph->xaxis->SetLabelFormatString('%d%%'); | |
159 | + $graph->yaxis->SetLabelFormatString('%d%%'); | |
160 | + | |
161 | + // For the x-axis we adjust the color so labels on the left of the Y-axis are in black | |
162 | + $n1 = floor(abs($this->iXMin/25))+1; | |
163 | + $n2 = floor($this->iXMax/25); | |
164 | + if( $this->iColorMap == 0 ) { | |
165 | + $xlcolors=array(); | |
166 | + for( $i = 0; $i < $n1; ++$i ) { | |
167 | + $xlcolors[$i] = 'black'; | |
168 | + } | |
169 | + for( $i = 0; $i < $n2; ++$i ) { | |
170 | + $xlcolors[$n1+$i] = 'lightgray:1.5'; | |
171 | + } | |
172 | + $graph->xaxis->SetColor('gray',$xlcolors); | |
173 | + $graph->yaxis->SetColor('gray','lightgray:1.5'); | |
174 | + } | |
175 | + else { | |
176 | + $graph->xaxis->SetColor('darkgray','darkgray:0.8'); | |
177 | + $graph->yaxis->SetColor('darkgray','darkgray:0.8'); | |
178 | + } | |
179 | + $graph->SetGridDepth(DEPTH_FRONT); | |
180 | + $graph->ygrid->SetColor('gray@0.6'); | |
181 | + $graph->ygrid->SetLineStyle('dotted'); | |
182 | + | |
183 | + $graph->ygrid->Show(); | |
184 | + | |
185 | + $graph->xaxis->SetWeight(1); | |
186 | + $graph->yaxis->SetWeight(1); | |
187 | + | |
188 | + $ytitle = new Text(CCBPGraph::YTitle,floor($lm*.75),($height-$tm-$bm)/2+$tm); | |
189 | + #$ytitle->SetFont(FF_VERA,FS_BOLD,$labelsize+1); | |
190 | + $ytitle->SetAlign('right','center'); | |
191 | + $ytitle->SetAngle(90); | |
192 | + $graph->Add($ytitle); | |
193 | + | |
194 | + $xtitle = new Text(CCBPGraph::XTitle,($width-$lm-$rm)/2+$lm,$height - 10); | |
195 | + #$xtitle->SetFont(FF_VERA,FS_BOLD,$labelsize); | |
196 | + $xtitle->SetAlign('center','bottom'); | |
197 | + $graph->Add($xtitle); | |
198 | + | |
199 | + $df = 'D j:S M, Y'; | |
200 | + if( $width < 400 ) { | |
201 | + $df = 'D j:S M'; | |
202 | + } | |
203 | + | |
204 | + $time = new Text(date($df),$width-10,$height-10); | |
205 | + $time->SetAlign('right','bottom'); | |
206 | + #$time->SetFont(FF_VERA,FS_NORMAL,$labelsize-1); | |
207 | + $time->SetColor('darkgray'); | |
208 | + $graph->Add($time); | |
209 | + | |
210 | + // Use an accumulated fille line graph to create the colored bands | |
211 | + | |
212 | + $n = 3; | |
213 | + for( $i=0; $i < $n; ++$i ) { | |
214 | + $b = $this->iColorInd[$i][0]; | |
215 | + $k = ($this->iColorInd[$i][1] - $this->iColorInd[$i][0])/$this->iXMax; | |
216 | + $colarea[$i] = array( array($lowx,$lowx*$k+$b), array($highx,$highx*$k+$b) ); | |
217 | + } | |
218 | + $colarea[3] = array( array($lowx,$highy), array($highx,$highy) ); | |
219 | + | |
220 | + | |
221 | + $cb = array(); | |
222 | + for( $i=0; $i < 4; ++$i ) { | |
223 | + $cb[$i] = new LinePlot(array($colarea[$i][0][1],$colarea[$i][1][1]), | |
224 | + array($colarea[$i][0][0],$colarea[$i][1][0])); | |
225 | + $cb[$i]->SetFillColor($this->iColorSpec[$this->iColorMap][$i]); | |
226 | + $cb[$i]->SetFillFromYMin(); | |
227 | + } | |
228 | + | |
229 | + $graph->Add(array_slice(array_reverse($cb),0,4)); | |
230 | + $this->graph = $graph; | |
231 | + } | |
232 | + /** | |
233 | + * Add a line or scatter plot to the graph | |
234 | + * | |
235 | + * @param mixed $aPlots | |
236 | + */ | |
237 | + public function Add($aPlots) { | |
238 | + if( is_array($aPlots) ) { | |
239 | + $this->iPlots = array_merge($this->iPlots,$aPlots); | |
240 | + } | |
241 | + else { | |
242 | + $this->iPlots[] = $aPlots; | |
243 | + } | |
244 | + } | |
245 | + /** | |
246 | + * Stroke the graph back to the client or to a file | |
247 | + * | |
248 | + * @param mixed $aFile | |
249 | + */ | |
250 | + public function Stroke($aFile='') { | |
251 | + $this->Init(); | |
252 | + if( count($this->iPlots) > 0 ) { | |
253 | + $this->graph->Add($this->iPlots); | |
254 | + } | |
255 | + $this->graph->Stroke($aFile); | |
256 | + } | |
257 | +} | |
258 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | +require_once ('jpgraph/jpgraph_error.php'); | |
5 | + | |
6 | + | |
7 | +//$datax = array(3.5,3.7,3,4,6.2,6,3.5,8,14,8,11.1,13.7); | |
8 | +$datay = array(1.23,1.9,1.6,3.1,3.4,2.8,2.1,1.9); | |
9 | +$graph = new Graph(300,200); | |
10 | +$graph->img->SetMargin(40,40,40,40); | |
11 | +$graph->img->SetAntiAliasing(); | |
12 | +$graph->SetScale("textlin"); | |
13 | +$graph->SetShadow(); | |
14 | +$graph->title->Set("Example of line centered plot"); | |
15 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
16 | + | |
17 | + | |
18 | +// Use 20% "grace" to get slightly larger scale then min/max of | |
19 | +// data | |
20 | +$graph->yscale->SetGrace(20); | |
21 | + | |
22 | + | |
23 | +$p1 = new LinePlot($datay); | |
24 | +$p1->mark->SetType(MARK_FILLEDCIRCLE); | |
25 | +$p1->mark->SetFillColor("red"); | |
26 | +$p1->mark->SetWidth(4); | |
27 | +$p1->SetColor("blue"); | |
28 | +$p1->SetCenter(); | |
29 | +$graph->Add($p1); | |
30 | + | |
31 | +$graph->Stroke(); | |
32 | + | |
33 | +?> | |
34 | + | |
35 | + | |
... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +<?php // content="text/plain; charset=utf-8" | |
2 | +require_once ('jpgraph/jpgraph.php'); | |
3 | +require_once ('jpgraph/jpgraph_line.php'); | |
4 | +require_once ('jpgraph/jpgraph_error.php'); | |
5 | + | |
6 | + | |
7 | +//$datax = array(3.5,3.7,3,4,6.2,6,3.5,8,14,8,11.1,13.7); | |
8 | +$datay = array(1.23,1.9,1.6,3.1,3.4,2.8,2.1,1.9); | |
9 | +$graph = new Graph(300,200); | |
10 | +$graph->img->SetMargin(40,40,40,40); | |
11 | +$graph->img->SetAntiAliasing(); | |
12 | +$graph->SetScale("textlin"); | |
13 | +$graph->SetShadow(); | |
14 | +$graph->title->Set("Example of filled line centered plot"); | |
15 | +$graph->title->SetFont(FF_FONT1,FS_BOLD); | |
16 | + | |
17 | +$p1 = new LinePlot($datay); | |
18 | +$p1->SetFillColor("green"); | |
19 | +$p1->mark->SetType(MARK_FILLEDCIRCLE); | |
20 | +$p1->mark->SetFillColor("red"); | |
21 | +$p1->mark->SetWidth(4); | |
22 | +$p1->SetColor("blue"); | |
23 | +$p1->SetCenter(); | |
24 | +$graph->Add($p1); | |
25 | + | |
26 | +$graph->Stroke(); | |
27 | + | |
28 | +?> | |
29 | + | |
30 | + | |
... | ... |