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 : 069840

Guest




อยากทราบว่า ถ้าสร้างกราฟเป็นไดนามิก ดังแสดงในโค้ดที่ให้มา จะสามารถดึงกราฟนี้ไปโชว์อีกหน้านึงที่เปนไดนามิกเหมือนกันได้มั้ยคะ โดยที่ทั้งกราฟ และหน้านั้น get ProductID เหมือนกัน
ขอบคุณล่วงหน้านะคะ ^^

Code (PHP)
<?php // content="text/plain; charset=utf-8"
// $Id: bar_csimex3.php,v 1.3 2002/08/31 20:03:46 aditus Exp $
// Horiontal bar graph with image maps
include ("C:/AppServ/www/JpGraph/src/jpgraph.php");
include ("C:/AppServ/www/JpGraph/src/jpgraph_bar.php"); 
include "config.php"; 
require("../cart/connect/function.php");
$resultDetail=select("nutritionfact","where ProductID='".$_GET["ProductID"]."'"); 
$a = $resultDetail["Ener"];
$b = $resultDetail["Suga"];
$c = $resultDetail["Total_F"];
$d = $resultDetail["Sodi"];


$data1y=array($a,$b,$c,$d);
$data2y=array(100-$a,100-$b,100-$c,100-$d);

// Setup the basic parameters for the graph
$graph = new Graph(400,700);
$graph->SetAngle(90);
$graph->SetScale("textlin");

// The negative margins are necessary since we
// have rotated the image 90 degress and shifted the 
// meaning of width, and height. This means that the 
// left and right margins now becomes top and bottom
// calculated with the image width and not the height.
$graph->img->SetMargin(-80,-80,210,210);

$graph->SetMarginColor('white');

// Setup title for graph
$graph->title->Set('Horizontal bar graph');
$graph->title->SetFont(FF_FONT2,FS_BOLD);
$graph->subtitle->Set("With image map\nNote: The URL just points back to this image");

// Setup X-axis.
$graph->xaxis->SetTitle("X-title",'center');
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetAngle(90);
$graph->xaxis->SetTitleMargin(30);
$graph->xaxis->SetLabelMargin(15);
$graph->xaxis->SetLabelAlign('right','center');

// Setup Y-axis

// First we want it at the bottom, i.e. the 'max' value of the
// x-axis
$graph->yaxis->SetPos('max');

// Arrange the title
$graph->yaxis->SetTitle("Turnaround (mkr)",'center');
$graph->yaxis->SetTitleSide(SIDE_RIGHT);
$graph->yaxis->title->SetFont(FF_FONT2,FS_BOLD);
$graph->yaxis->title->SetAngle(0);
$graph->yaxis->title->Align('center','top');
$graph->yaxis->SetTitleMargin(30);

// Arrange the labels
$graph->yaxis->SetLabelSide(SIDE_RIGHT);
$graph->yaxis->SetLabelAlign('center','top');

// Create the bar plots with image maps
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$targ=array("bar_clsmex2.php#1","bar_clsmex2.php#2","bar_clsmex2.php#3",
            "bar_clsmex2.php#4","bar_clsmex2.php#5","bar_clsmex2.php#6");
$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
$b1plot->SetCSIMTargets($targ,$alts);

$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
$targ=array("bar_clsmex2.php#7","bar_clsmex2.php#8","bar_clsmex2.php#9",
            "bar_clsmex2.php#10","bar_clsmex2.php#11","bar_clsmex2.php#12");
$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
$b2plot->SetCSIMTargets($targ,$alts);

// Create the accumulated bar plot
$abplot = new AccBarPlot(array($b1plot,$b2plot));
$abplot->SetShadow();

// We want to display the value of each bar at the top
$abplot->value->Show();
$abplot->value->SetFont(FF_FONT1,FS_NORMAL);
$abplot->value->SetAlign('left','center');
$abplot->value->SetColor("black","darkred");
$abplot->value->SetFormat('%.1f mkr');

// ...and add it to the graph
$graph->Add($abplot);

// Send back the HTML page which will call this script again
// to retrieve the image.
$graph->StrokeCSIM();

?>




Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-12-02 19:25:28 By : Supergirl View : 1176 Reply : 3
 

 

No. 1



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

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

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

ส่ง ProductID ไปอีกหน้าหนึ่ง แล้วก็เรียกเหมือนกันครับ ง่ายดี






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-12-03 06:24:39 By : webmaster
 


 

No. 2

Guest


แล้วถ้าในหน้าที่จะให้กราฟแสดง หนูเขียนโค้ดอย่างนี้ ต้องแก้ตรงไหนมั้นคะ เพราะขึ้น error ตรงที่จะให้แสดงกราฟอ่าค่ะ

Code (PHP)
<html>
<head>
<title>ข้อมูลโภชนาการ</title>
</head>
<body bgcolor="#98FB98">
<? 
	include "config.php"; 
	require("../cart/connect/function.php");
	$resultDetail=select("nutritionfact","where ProductID='".$_GET["ProductID"]."'"); 
?>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#98FB98">
<tr><td width="778" align="center"><img src="<?=$resultDetail["Fig"];?>" height="200"></td></tr>
<tr><td width="778" align="center"><img src="ok.php?ProductID=<? $_GET["ProductID"] ?>"></td></tr></table>
</body>
</html>


รูปตัวอย่าง
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-12-03 13:07:39 By : Supergirl
 

 

No. 3



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

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

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

มันไม่มีค่าตัวแปรที่จะส่งให้ jpGraph หรือเปล่าครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-12-03 23:48:50 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
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 04
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 อัตราราคา คลิกที่นี่