|
|
|
อยากจะนำรูป กราฟใน jpgraph มาออก report เป็น pdf ต้องทำยังไงค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<?
unlink("graph_generate.jpg");
///////////other//////////////////
/*$hn_number=$_POST[hn_number];
$name=$_POST[name];
$age=$_POST[age];
*/
function value_to_text($value_input){
if($value_input < 50){
$return_value = 'low';
}elseif($value_input == 50){
$return_value = 'average';
}else{
$return_value = 'over';
}
return $return_value;
}
function bio_value($value_input){
if($value_input < 50){
$return_value = '-1';
}elseif($value_input == 50){
$return_value = 0;
}else{
$return_value = 1;
}
return $return_value;
}
/*echo "<pre>";
print_r($_POST);
echo "</pre>";*/
function plot($value_input){
if($value_input < 50){
$return_value = "40";
}elseif($value_input == 50){
$return_value = "60";
}else{
$return_value = "100";
}
return $return_value;
}
$value_01 = plot($_POST[value1]);
$value_02 = plot($_POST[value2]);
$value_03 = plot($_POST[value3]);
$value_04 = plot($_POST[value4]);
$value_05 = plot($_POST[value5]);
$value_06 = plot($_POST[value6]);
///////////////////////////////
//////////start graph//////////////
require_once("jpgraph/jpgraph.php");
require_once("jpgraph/jpgraph_radar.php");
// Create the basic radar graph
$mygraph = new RadarGraph (550,500);
// Set background color and shadow
$mygraph->SetShadow();
$mygraph->SetBackgroundImage('sss.jpg', BGIMG_FILLFRAME);
// Position the graph
$mygraph->SetCenter(0.5, 0.55);
$mygraph->SetSize(0.7);
// Setup the grid lines
$mygraph->grid->Show();
$mygraph->grid->SetLineStyle('dotted');
$mygraph->grid->SetColor('black');
$mygraph->grid->SetWeight(1);
// Setup graph titles
$titles = array("Cardiorespiratory \nEndurance", "Agility", "Anaerobic \nPower", "Muscle \nEndurance", "Flexibility", "Muscle \nStrength");
$mygraph->SetTitles($titles);
$mygraph->title->Set("Evaluation Diagram");
$mygraph->title->SetFont(FF_FONT2, FS_BOLD);
$mygraph->title->SetColor('black');
// Create the first radar plot lineblue
$data = array($value_01,$value_06,$value_05,$value_04,$value_03,$value_02 );
$radplot1 = new RadarPlot ($data);
$radplot1->SetColor('black', 'white');
$legend1= "Calculate Result";
$radplot1->SetLegend($legend1);
$radplot1->SetLineWeight(1);
$radplot1->mark->SetType(MARK_IMG_SBALL,'bluegreen');
// Create the second radar plot linered
$data2 = array(60, 60, 60, 60, 60, 60);
$radplot2 = new RadarPlot ($data2);
$radplot2->SetColor('red');
$radplot2->SetLineWeight(1);
$legend2="Standard Value";
$radplot2->SetLegend($legend2);
$radplot2->mark->SetType(MARK_IMG_SBALL,'red');
// Add the plots to the graph
$mygraph->Add($radplot1);
$mygraph->Add($radplot2);
// And output the graph
//$mygraph->Stroke($image);
$mygraph->Stroke("graph_generate");
$flgRename = rename("graph_generate", "graph_generate.jpg");
if($flgRename)
{
?>
<img src="graph_generate.jpg" border="0" />
<table width="520" border="0">
<tr>
<td align="right"><a href="pdf_graph.php?hn_number=<?=$hn_number?>&name=<?=$name?>&age=<?=$age?>&value1=<?=$value1?>&value2=<?=$value2?>&value3=<?=$value3?>&value4=<?=$value4?>&value5=<?=$value5?>&value=<?=$value1?>">PDF</a> <a href="excel/excel_graph.php?hn_number=<?=$hn_number?>&name=<?=$name?>&bmi=<?=$bmi?>">EXCEL</a><a href="graph.html">GRAPH</td>
</tr>
</table>
<?
}else{ echo "no image"; }
?>
Tag : PHP, MySQL, HTML/CSS, Report Others, Class Library
|
|
|
|
|
|
Date :
2011-06-09 18:35:43 |
By :
ying |
View :
1546 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unlink ถ้ามันมี มันคงลบไปแล้วนะครับ...
|
|
|
|
|
Date :
2011-06-09 20:37:19 |
By :
t-monroe |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|