 |
JP Graph สามารถ select sql ออกมาทีละตัวได้ไหมคะ แล้วค่อยนำมาพอร์ตกราฟทีละจุด |
|
 |
|
|
 |
 |
|
array_merge ใน php มีมาให้ครับ
Code (PHP)
<?php
$array1 = array("color" => "red", 2, 4);
$array2 = array("a", "b", "color" => "green", "shape" => "trapezoid", 4);
$result = array_merge($array1, $array2);
print_r($result);
?>
|
 |
 |
 |
 |
Date :
2011-11-21 22:15:21 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อันที่จริงทำที่ Query ก็ได้ครับ โดยใช้การ UNION กันครับ
Go to : SQL UNION ALL
Go to : SQL UNION
|
 |
 |
 |
 |
Date :
2011-11-22 21:30:34 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณค่ะ จะลองทำดู
|
 |
 |
 |
 |
Date :
2011-11-22 23:01:26 |
By :
mooae |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php //content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
$db= mysql_connect("localhost","root","1234") or die(mysql_error());
mysql_select_db("hrm",$db) or die("db ploblem");
//$sql1="SELECT * FROM recruitment_people ";
$sql1="SELECT COUNT(mate_edu) AS num_grade FROM recruitment_people WHERE mate_edu = 'ปริญญาตรี' ";
$querysql1 = mysql_query($sql1) or die(mysql_error());
$rowssql1 = mysql_fetch_array($querysql1);
$grade_bachelor = $rowssql1['num_grade'];
$sql2="SELECT COUNT(mate_edu) AS num_grade FROM recruitment_people WHERE mate_edu = 'ปวส.' " ;
$querysql2 = mysql_query($sql2) or die(mysql_error());
$rowssql2 = mysql_fetch_array($querysql2);
$grade_high = $rowssql2['num_grade'];
$sql3="SELECT COUNT(mate_edu) AS num_grade FROM recruitment_people WHERE mate_edu ='ปวช.' ";
$querysql3 = mysql_query($sql3) or die(mysql_error());
$rowssql3 = mysql_fetch_array($querysql3);
$grade_vocation = $rowssql3['num_grade'];
//$datay=array(1,1,9);
$datay=array($grade_bachelor,$grade_high,$grade_vocation);
// Create the graph. These two calls are always required
$graph = new Graph(800,600);
$graph->SetScale("textlin");
$graph->yaxis->scale->SetGrace(20);
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->img->SetMargin(40,30,20,40);
// Create a bar pot
$bplot = new BarPlot($datay);
// Adjust fill color
$bplot->SetFillColor('blue');
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD,10);
$bplot->value->SetAngle(45);
//$bplot->value->SetFormat('%0.1f');
$graph->Add($bplot);
// Setup the titles
$data=array("Vocation","High_Vocation.","Bachelor");
$graph->title->Set("Report Graph");
$graph->yaxis->title->Set("Num");
$graph->xaxis->title->Set("Grade");
$graph->xaxis->SetTickLabels($data);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
//แสดงรูปกราฟ
$graph->Stroke();
?>
มันไม่ขึ้นแท่งกราฟอ่ะคะ ขึ้นแต่ แกนx แกนy
|
 |
 |
 |
 |
Date :
2011-11-22 23:19:54 |
By :
mooae |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|