Source for file xml2pdf.graph.line.php
Documentation is available at xml2pdf.graph.line.php
* Xml2Pdf curve graph plugin file
* @author guillaume l. <guillaume@geelweb.org>
* @link http://www.geelweb.org geelweb-dot-org
* @license http://opensource.org/licenses/bsd-license.php BSD License
* @copyright copytight © 2006, guillaume luchet
* Plugin class xml2pdf_graph_line
* <graph type='line' width='120' height='50' left='60' top='220' position='absolute' color='#0197cb' legend='' repere='10'>
* <line legend='courbe1'>
* <line legend='courbe2' color='#0197cb'>
* @author guillaume l. <guillaume@geelweb.org>
* @link http://www.geelweb.org geelweb-dot-org
* @license http://opensource.org/licenses/bsd-license.php BSD License
* @copyright copytight © 2006, guillaume luchet
* @tutorial Xml2Pdf/Xml2Pdf.Graph.line.pkg
// xml2pdf_graph_line::__construct() {{{
* Draw a curve type graph
* @param Object $graph Object Xml2Pdf_Tag_graph
$graph->pdf->SetFont('Courier', '', $graph->fontSize);
$XPage =
$graph->pdf->GetX();
$YPage =
$graph->pdf->GetY();
$lDiag =
$graph->width -
$graph->legendWidth -
5 *
$marge-
5;
$XDiag =
$XPage +
$marge;
$YDiag =
$YPage +
$marge;
foreach($graph->data as $line) {
if($xMax <
max($line['x'])) {
if($yMax <
max($line['y'])) {
$uniteY =
($hDiag) /
($yMax+
5);
$graph->pdf->SetLineWidth(0.2);
$graph->pdf->Rect($XDiag, $YDiag, $lDiag, $hDiag);
$tab =
Xml2Pdf::ConvertColor('#dcdcdc');
$graph->pdf->SetDrawColor($tab['r'],$tab['g'],$tab['b']);
$deltaX =
$lDiag /
($graph->nbIndRepere);
$deltaY =
$hDiag /
($graph->nbIndRepere);
$graph->pdf->SetLineWidth(0.2);
for($i=
0 ; $i<=
$graph->nbIndRepere ; $i++
) {
if($i>
0 &&
$i<
$graph->nbIndRepere) {
$graph->pdf->Line($XDiag, $YDiag+
($i*
$deltaY),
$XDiag+
$lDiag, $YDiag+
($i*
$deltaY));
$graph->pdf->Line($XDiag+
($i*
$deltaX), $YDiag,
$XDiag+
($i*
$deltaX), $YDiag+
$hDiag);
$valY =
floor(($hDiag-
($i*
$deltaY))/
$uniteY);
$valX =
floor(($i*
$deltaX)/
$uniteX);
$lenY =
$graph->pdf->GetStringWidth($valY);
$lenX =
$graph->pdf->GetStringWidth($valX);
$graph->pdf->Text($XDiag-
$lenY-
2, $YDiag+
($i*
$deltaY), $valY);
$graph->pdf->Text($XDiag+
($i*
$deltaX)-
$lenX/
2, $YDiag+
$hDiag+
5, $valX);
$graph->pdf->SetLineWidth(0.5);
foreach($graph->data as $key=>
$line) {
if ($graph->colors[$key] ==
null) {
$tab =
Xml2Pdf::ConvertColor($graph->colors[$key]);
$graph->pdf->SetDrawColor($tab['r'],$tab['g'],$tab['b']);
for($i=
0 ; $i<
$nbPoint-
1 ; $i++
) {
$xd =
$XDiag +
$line['x'][$i]*
$uniteX;
$yd =
$YDiag+
$hDiag-
$line['y'][$i]*
$uniteY;
$xf =
$XDiag +
$line['x'][$i+
1]*
$uniteX;
$yf =
$YDiag+
$hDiag-
$line['y'][$i+
1]*
$uniteY;
$graph->pdf->Line($xd, $yd, $xf, $yf);
$graph->pdf->SetLineWidth(0.2);
$tab =
Xml2Pdf::ConvertColor('#000000');
$graph->pdf->SetDrawColor($tab['r'],$tab['g'],$tab['b']);
$graph->pdf->SetFont('Courier', '', $graph->fontSize);
$x1 =
$XPage +
$lDiag +
4 *
$marge;
for($i=
0; $i<
$graph->nbVal; $i++
) {
$tab =
Xml2Pdf::ConvertColor($graph->colors[$graph->legends[$i]]);
$graph->pdf->SetFillColor($tab['r'],$tab['g'],$tab['b']);
$graph->pdf->Rect($x1, $y1+
$i*
$marge*
2, 5,5, 'DF');
$graph->pdf->SetXY($x2,$y1+
$i*
$marge*
2);
$graph->pdf->Cell(0,5,$graph->legends[$i]);
Documentation generated on Wed, 11 Oct 2006 22:27:15 +0200 by phpDocumentor 1.3.0