File: nullvalueex01.php

package info (click to toggle)
libphp-jpgraph 1.5.2-11%2Bu1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 888 kB
  • ctags: 2,689
  • sloc: php: 8,992; makefile: 24
file content (56 lines) | stat: -rwxr-xr-x 1,380 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
include ("/usr/share/jpgraph/jpgraph.php");
include ("/usr/share/jpgraph/jpgraph_line.php");

// Some data
$datax = array("2001-04-01","2001-04-02","2001-04-03",
				   "2001-04-04","2001-04-05","2001-04-06");
$datay = array(28,13,24,"",90,11);
$data2y = array(11,41,"-",33,"-",63);

// A nice graph with anti-aliasing
$graph = new Graph(450,250,"auto");
$graph->img->SetMargin(40,170,40,80);	
//$graph->img->SetAntiAliasing();
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->title->Set("Line plot with null values");

// Use built in font
$graph->title->SetFont(FF_FONT1,FS_BOLD);

// Slightly adjust the legend from it's default position in the
// top right corner. 
$graph->legend->Pos(0.03,0.5,"right","center");

// Setup X-scale
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetFont(FF_FONT1);
$graph->xaxis->SetLabelAngle(90);

// Create the first line
$p1 = new LinePlot($datay);
$p1->mark->SetType(MARK_FILLEDCIRCLE);
$p1->mark->SetFillColor("red");
$p1->mark->SetWidth(4);
$p1->SetColor("blue");
$p1->SetCenter();
$p1->SetLegend("Undefined variant 1");
$graph->Add($p1);

// ... and the second
$p2 = new LinePlot($data2y);
$p2->mark->SetType(MARK_STAR);
$p2->mark->SetFillColor("red");
$p2->mark->SetWidth(4);
$p2->SetColor("red");
$p2->SetCenter();
$p2->SetLegend("Undefined variant 2");
$graph->Add($p2);

// Output line
$graph->Stroke();

?>