Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ช่วยที่ค่ะ jpgraphไม่ขึ้น แบบนี้กราฟทำงานได้ปกติถึงจะยังไม่มีข้อมูลการฟขึ้นมาแบบไม่มีข้อมูล ปกติ



 

ช่วยที่ค่ะ jpgraphไม่ขึ้น แบบนี้กราฟทำงานได้ปกติถึงจะยังไม่มีข้อมูลการฟขึ้นมาแบบไม่มีข้อมูล ปกติ

 



Topic : 088209



โพสกระทู้ ( 70 )
บทความ ( 0 )



สถานะออฟไลน์




แบบนี้กราฟทำงานได้ปกติถึงจะยังไม่มีข้อมูลการฟขึ้นมาแบบไม่มีข้อมูล ปกติ (PHP)
include("../JpGraph/src/jpgraph.php");
include("../JpGraph/src/jpgraph_bar.php");
$g = new Graph(500, 300);
$g->SetScale("textlin");

$title = iconv("tis-620", "utf-8", "รายงาน");
$g->title->Set($title);
$g->title->SetFont(FF_JASMINE, FS_BOLD, 16);

$labels = array("m", "sd", "sd", "SDF" ,"df", "fs");
for($i = 0; $i < count($labels); $i++) {
	$labels[$i] = iconv("tis-620", "utf-8", $labels[$i]);
}
$g->xaxis->SetTickLabels($labels);
$g->xaxis->SetFont(FF_CORDIA, FS_NORMAL, 14);
$g->xaxis->SetLabelAngle(0);

$data1 = array($mon1 , $mon2 , $mon3 ,  $mon4 , $mon5 , $mon6 ,$mon7 ,$mon8 ,$mon9 ,$mon10 ,$mon11 ,$mon12 );
$bar1 = new BarPlot($data1);

$data2 = array($mont1 , $mont2 , $mont3 ,  $mont4 , $mont5 , $mont6 ,$mont7 ,$mont8 ,$mont9 ,$mont10 ,$mont11 ,$mont12);
$bar2 = new BarPlot($data2);



$bar1->value->Show();
$bar1->value->SetAngle(90);
$bar1->SetFillColor("blue");
$bar1->SetLegend("Product 1");

$bar2->value->Show();
$bar2->value->SetAngle(90);
$bar2->SetFillColor("lightgray");
$bar2->SetLegend("Product 2");



$bars = array($bar1, $bar2);
$gb = new GroupBarPlot($bars);

$g->Add($gb);
$g->Stroke();




---------------------------------------------------------------------------------------------------------------------------------------------------
แต่เมื่อลงเพิ่มโค๊ดเค้าไปมันเออเลอฺร์ (PHP)
///////สว่นที่เพิ่ม//////////////////////////////////////////////////////
<?
include("../JpGraph/src/jpgraph.php");
include("../JpGraph/src/jpgraph_bar.php");
include("../connect.php");
$year1 = $_GET['year1'];
$year2 = $_GET['year2'];
$sql1 = "select * from rent WHERE year = $year1";
$result1 = mysql_query($sql1);
while($row1 = mysql_fetch_array($result1)){
	
	//$mon1  += $row1['month1'];
	$mon2  += $row1['month2'];
	$mon3  += $row1['month3'];
	$mon4  += $row1['month4'];
	$mon5  += $row1['month5'];
	$mon6  += $row1['month6'];
	$mon7  += $row1['month7'];
	$mon8  += $row1['month8'];
	$mon9  += $row1['month9'];
	$mon10 += $row1['month10'];
	$mon11 += $row1['month11'];
	$mon12 += $row1['month12'];
	
	}
$totlemon1 = $mon1 +$mon2 +$mon3 +$mon4 +$mon5 +$mon6 +$mon7 +$mon8 +$mon9 +$mon10 +$mon11 +$mon12; 
$sql2 = "select * from rent WHERE year = $year2";
$result2 = mysql_query($sql2);
while($row2 = mysql_fetch_array($result2)){
	$mont1  += $row2['month1'];
	$mont2  += $row2['month2'];
	$mont3  += $row2['month3'];
	$mont4  += $row2['month4'];
	$mont5  += $row2['month5'];
	$mont6  += $row2['month6'];
	$mont7  += $row2['month7'];
	$mont8  += $row2['month8'];
	$mont9  += $row2['month9'];
	$mont10 += $row2['month10'];
	$mont11 += $row2['month11'];
	$mont12 += $row2['month12'];
	
	}
	$totlemon2 = $mont1 +$mont2 +$mont3 +$mont4 +$mont5 +$mont6 +$mont7 +$mont8 +$mont9 +$mont10 +$mont11 +$mont12;
/////////////////////สว่นที่เพิ่ม//////////////
$g = new Graph(500, 300);
$g->SetScale("textlin");

$title = iconv("tis-620", "utf-8", "รายงาน");
$g->title->Set($title);
$g->title->SetFont(FF_JASMINE, FS_BOLD, 16);

$labels = array("m", "sd", "sd", "SDF" ,"df", "fs");
for($i = 0; $i < count($labels); $i++) {
	$labels[$i] = iconv("tis-620", "utf-8", $labels[$i]);
}
$g->xaxis->SetTickLabels($labels);
$g->xaxis->SetFont(FF_CORDIA, FS_NORMAL, 14);
$g->xaxis->SetLabelAngle(0);

$data1 = array($mon1 , $mon2 , $mon3 ,  $mon4 , $mon5 , $mon6 ,$mon7 ,$mon8 ,$mon9 ,$mon10 ,$mon11 ,$mon12 );
$bar1 = new BarPlot($data1);

$data2 = array($mont1 , $mont2 , $mont3 ,  $mont4 , $mont5 , $mont6 ,$mont7 ,$mont8 ,$mont9 ,$mont10 ,$mont11 ,$mont12);
$bar2 = new BarPlot($data2);



$bar1->value->Show();
$bar1->value->SetAngle(90);
$bar1->SetFillColor("blue");
$bar1->SetLegend("Product 1");

$bar2->value->Show();
$bar2->value->SetAngle(90);
$bar2->SetFillColor("lightgray");
$bar2->SetLegend("Product 2");



$bars = array($bar1, $bar2);
$gb = new GroupBarPlot($bars);

$g->Add($gb);
$g->Stroke();
?>



มันขึ้นว่า


Code
JpGraph Error: HTTP headers have already been sent.
Caused by output from file jp.php at line 10.
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).
Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.

For example it is a common mistake to leave a blank line before the opening "<?php".



ไม่ทราบว่าแก้ยังไงดีค่ะ



Tag : PHP









ประวัติการแก้ไข
2012-12-18 19:17:55
2012-12-18 19:18:34
2012-12-18 19:19:31
2012-12-18 19:20:59
2012-12-18 19:37:05
2012-12-18 21:16:58
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-12-18 19:16:37 By : mameaw4569 View : 1212 Reply : 4
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ถ้าแบบนี้สงสัยจะต้องนั่ง remove ทีล่ะบรรทัด แล้วค่อย ๆ ไล่หาครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-12-19 14:38:28 By : mr.win
 


 

No. 2



โพสกระทู้ ( 70 )
บทความ ( 0 )



สถานะออฟไลน์


ttt
กราฟเละแบบนี้จะปรับยังไงค่ะ เลขข้างน้ามันหายไปอะค่ะ จะปรับขอบในยังไง

ส่วนเรื่องภาษาไวค่อยแก้ที่หลัง



แล้วคือกราฟมันไปติดอยู่มุมซ้ายบน แล้วจะให้แสดงตรงกลางยังไง


Code (PHP)
<?
include("../JpGraph/src/jpgraph.php");
include("../JpGraph/src/jpgraph_bar.php");
include("../connect.php");

$totlemon1 = $mon1 +$mon2 +$mon3 +$mon4 +$mon5 +$mon6 +$mon7 +$mon8 +$mon9 +$mon10 +$mon11 +$mon12; 
$totlemon2 = $mont1 +$mont2 +$mont3 +$mont4 +$mont5 +$mont6 +$mont7 +$mont8 +$mont9 +$mont10 +$mont11 +$mont12;

$title = "รายได้(บาท)";
$g = new Graph(1000, 500);
$g->SetScale("textlin");

$title = iconv("tis-620", "utf-8", "รายงาน");
$g->title->Set($title);
$g->title->SetFont(FF_JASMINE, FS_BOLD, 16);


$labels = array("ม.ค.", "ก.พ.", "มี.ค", "เม.ย." ,"พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค.","รวม","55");
for($i = 0; $i < count($labels); $i++) {
	$labels[$i] = iconv("tis-620", "utf-8", $labels[$i]);
}
$g->xaxis->SetTickLabels($labels);
$g->xaxis->SetFont(FF_CORDIA, FS_NORMAL, 14);
$g->xaxis->SetLabelAngle(0);

$data1 = array($mon1 , $mon2 , $mon3 ,  $mon4 , $mon5 , $mon6 ,$mon7 ,$mon8 ,$mon9 ,$mon10 ,$mon11 ,$mon12, "" ,"");
$bar1 = new BarPlot($data1);

$data2 = array($mont1 , $mont2 , $mont3 ,  $mont4 , $mont5 , $mont6 ,$mont7 ,$mont8 ,$mont9 ,$mont10 ,$mont11 ,"" ,"");
$bar2 = new BarPlot($data2);
$data3 = array("" , "", "" ,  "" , "", "" ,"" ,"","" ,"" ,"" ,"", "",$totlemon1);
$bar3 = new BarPlot($data3);


$bar1->value->Show();
$bar1->value->SetAngle(0);
$bar1->SetFillColor("blue");
$bar1->SetLegend($year1);

$bar2->value->Show();
$bar2->value->SetAngle(0);
$bar2->SetFillColor("lightgray");
$bar2->SetLegend($year2);
$bar3->value->Show();
$bar3->value->SetAngle(0);
$bar3->SetFillColor("red");
$bar3->SetLegend("รวม");


$bars = array($bar1, $bar2,$bar3);
$gb = new GroupBarPlot($bars);

$g->Add($gb);
$g->Stroke();
?>
<?
$year1 = $_POST['year1'];
$year2 = $_POST['year2'];

    $mon1  = $_POST['mon1'];
	$mon2  = $_POST['mon1'];
	$mon3  = $_POST['mon1'];
	$mon4  = $_POST['mon1'];
	$mon5  = $_POST['mon1'];
	$mon6  = $_POST['mon1'];
	$mon7 = $_POST['mon1'];
	$mon8  = $_POST['mon1'];
	$mon9  = $_POST['mon1'];
	$mon10 = $_POST['mon1'];
	$mon11 = $_POST['mon1'];
	$mon12 = $_POST['mon1'];
    $mont1  = $_POST['mont1'];
	$mont2  = $_POST['mont2'];
	$mont3 = $_POST['mont3'];
	$mont4  = $_POST['mont4'];
	$mont5  = $_POST['mont5'];
	$mont6  = $_POST['mont6'];
	$mont7  = $_POST['mont7'];
	$mont8  = $_POST['mont8'];
	$mont9  = $_POST['mont9'];
	$mont10 = $_POST['mont10'];
	$mont11 = $_POST['mont11'];
	$mont12 = $_POST['mont12'];


    ?>
	<? header("location: rent.php"); ?>



ประวัติการแก้ไข
2012-12-19 18:54:43
2012-12-19 18:55:42
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-12-19 18:54:13 By : mameaw4569
 

 

No. 3



โพสกระทู้ ( 70 )
บทความ ( 0 )



สถานะออฟไลน์


ทำได้แล้ว
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-12-19 23:24:03 By : mameaw4569
 


 

No. 4



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ตกลงเป็นเพราะอะไรครับ ?
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-12-20 06:23:57 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยที่ค่ะ jpgraphไม่ขึ้น แบบนี้กราฟทำงานได้ปกติถึงจะยังไม่มีข้อมูลการฟขึ้นมาแบบไม่มีข้อมูล ปกติ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่