-
Notifications
You must be signed in to change notification settings - Fork 5
/
SmallStacked.php
47 lines (41 loc) · 1.55 KB
/
SmallStacked.php
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
<?php
/*
Example21 : A single stacked bar graph
*/
// Standard inclusions
include("src/pData.php");
include("src/pChart.php");
// Dataset definition
$DataSet = new pData;
$DataSet->AddPoint(1,"Serie1");
$DataSet->AddPoint(3,"Serie2");
$DataSet->AddPoint(3,"Serie3");
$DataSet->AddPoint("A#~1","Labels");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Labels");
$DataSet->SetAbsciseLabelSerie("Labels");
$DataSet->SetSerieName("Alpha","Serie1");
$DataSet->SetSerieName("Beta","Serie2");
$DataSet->SetSerieName("Gama","Serie3");
$DataSet->SetYAxisName("Test Marker");
$DataSet->SetYAxisUnit("µm");
// Initialise the graph
$Test = new pChart(210,230);
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->setGraphArea(65,30,125,200);
$Test->drawFilledRoundedRectangle(7,7,203,223,5,240,240,240);
$Test->drawRoundedRectangle(5,5,205,225,5,230,230,230);
$Test->drawGraphArea(255,255,255,TRUE);
$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALLSTART0,150,150,150,TRUE,0,2,TRUE);
$Test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf",6);
$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$Test->drawStackedBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),50);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->drawLegend(135,150,$DataSet->GetDataDescription(),255,255,255);
$Test->setFontProperties("Fonts/tahoma.ttf",10);
$Test->drawTitle(0,22,"Sample size",50,50,50,210);
$Test->Render("SmallStacked.png");