|
 |
|
ช่วยดูโค๊ดนี้ให้หน่อยครับ จากcodeข้างบน ปัญาหาคือ พอเรียกใช้ฟังก์ชัน chart()ในบรรทัดที่ 96 |
|
 |
|
|
 |
 |
|
Code (PHP)
<script type="text/javascript" src="../js/swfobject.js"></script>
<div id="my_chart"></div>
<script type="text/javascript">
function chart(value1,value2,value3,type,ymax){
var my_chart = new SWFObject("../actionscript/open-flash-chart.swf", "ofc", "900", "376", "9", "#FFFFFF");
my_chart.addVariable("variables","true");
my_chart.addVariable("title","กราฟแสดงข้อมูลประเภทของฎีกา,{font-size: 16;}");
my_chart.addVariable("y_legend","จำนวนรายการ,12,0x736AFF");
my_chart.addVariable("y_label_size","14");
my_chart.addVariable("y_ticks","5,10,4");
my_chart.addVariable("bar","50,0x9933CC,จำนวนรายการทั้งหมด,10");
my_chart.addVariable("bar_2","50,0x999900,จำนวนเรื่องที่ยังไม่ปิด,10");
//my_chart.addVariable("line_dot_2","3,#CC3399,Line,10,5");
my_chart.addVariable("bar_3","50,0x00CCCC,จำนวนเรื่องที่ปิดแล้ว,10");
my_chart.addVariable("values",value1);
my_chart.addVariable("values_2",value2);
my_chart.addVariable("values_3",value3);
my_chart.addVariable("x_labels",type);
my_chart.addVariable("x_axis_steps","2");
my_chart.addVariable("y_max",ymax);
my_chart.write("my_chart");
so.addParam("allowScriptAccess", "always" );//"sameDomain");
so.write("my_chart");
}
</script>
<?php
$i=0;
$j=0;
$group_name=array();
$group_id1=array();
$group_id=array();
$finish=array();
$countT=array();
$countF=array();
$countNF=array();
include("dbcon.php");
$sql="select * from petition";
$rs=$db->query($sql);
if (DB::isError($rs)){
die($rs->getMessage());
}
else{
while($row=$rs->fetchRow()){
$group_id[$j]=$row['pet_group_id'];
$finish[$j]=$row['finishflag'];
$j++;
}}
include("dbcon.php");
$sql1="select * from petition_group";
$rss=$db->query($sql1);
if (DB::isError($rss)){
die($rss->getMessage());
}
else{
while($row1=$rss->fetchRow()){
$group_name[$i]=$row1['group_name'];
$group_id1[$i]=$row1['pet_group_id'];
$i++;
}}
for($k=0;$k<$i;$k++){
$countT[$k]=0;
$countNF[$k]=0;
$countF[$k]=0;
}
for($k=0;$k<$i;$k++){
for($l=0;$l<$j;$l++){
if($group_id1[$k]==$group_id[$l]){
$countT[$k]++;
if($finish[$l]==0){
$countNF[$k]++;
}
}
}
}
for($k=0;$k<$i;$k++){
$countF[$k]=$countT[$k]-$countNF[$k];
}
$max=$countT[0];
for($k=1;$k<$i;$k++){
if($countT[$k-1]<$countT[$k]){
$max=$countT[$k];
}
}
$type1 = implode(",",$group_name);
$nonFinish = implode(",",$countNF);
$Finish = implode(",",$countF);
$Total = implode(",",$countT);
echo "<script>";
echo "var type = new Array($type1);";
echo "var value2 = new Array($nonFinish);";
echo "var value3 = new Array($Finish);";
echo "var value1 = new Array($Total);";
echo "chart(value1,value2,value3,type,$max+3);";
echo "</script>";
//echo $type1."<br>".$nonFinish."<br>".$Finish."<br>".$Total;
?>
จากcodeข้างบน ปัญาหาคือ พอเรียกใช้ฟังก์ชัน chart()ในบรรทัดที่ 96 แล้วมันไม่ทำงาน ซึ่งจากการทดสอบพบว่าที่ม่ทำงานเพราะ
code บรรทัด51-62(ลองคอมเม้นดู แล้วฟังก์ชันทำงานแต่ไม่สมบูณร์) ซึ่งอยากถามว่า ในช่วงบรรทัด 51-62 ผมควรแก้ยังไงดี หรือสาเหตุการไม่ทำงานของฟังก์ชันมาจากส่วนอื่น ช่วยแนะนำหน่อยครับ
ขอบคุณครับ
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-11-28 15:01:57 |
By :
sung55 |
View :
887 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ง่ะ
- -*
|
 |
 |
 |
 |
Date :
2009-11-28 19:26:27 |
By :
sung55 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|