 |
สอบถามวิธีเรียก jpgraph จาก controller ไปแสดงกราฟที่หน้าวิว |
|
 |
|
|
 |
 |
|
คือต้องการให้กราฟไปแสดงในหน้าวิวครับ เพราะตอนนี้เวลาผมเรียกController มันจะแสดงเลยครับ
Code (PHP)
public function test(){
// Some data
$p1 = array(20,27,45,75,90);
// Create the Pie Graph.
$graph = new PieGraph(800,450);
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("Pie Graph");
$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1,0.2);
$graph->legend->Pos(0.9,0.9,'left','bottom');
$graph->legend->SetLayout(LEGEND_VERT);
// Create pie plot
$p1 = new PiePlot3d($p1);
$p1->SetTheme("earth");
$p1->SetCenter(0.4);
$p1->SetAngle(20);
$p1->value->SetFont(FF_ARIAL,FS_NORMAL,12);
$p1->SetLegends(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct"));
$graph->Add($p1);
$data['test'] = $graph->Stroke();
$this->load->view("test", $data);
}
Tag : PHP
|
ประวัติการแก้ไข 2013-10-22 13:06:13
|
 |
 |
 |
 |
Date :
2013-10-22 13:02:13 |
By :
kenghockey |
View :
890 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Controller Code (PHP)
public function test(){
// Some data
$p1 = array(20,27,45,75,90);
// Create the Pie Graph.
$graph = new PieGraph(800,450);
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("Pie Graph");
$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1,0.2);
$graph->legend->Pos(0.9,0.9,'left','bottom');
$graph->legend->SetLayout(LEGEND_VERT);
// Create pie plot
$p1 = new PiePlot3d($p1);
$p1->SetTheme("earth");
$p1->SetCenter(0.4);
$p1->SetAngle(20);
$p1->value->SetFont(FF_ARIAL,FS_NORMAL,12);
$p1->SetLegends(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct"));
$graph->Add($p1);
$data['graps'] = $graph->Stroke();
$this->load->view("viewfile", $data);
}
View Code (PHP)
<?php
echo $graps; // มาจาก $data[graps];
?>
|
ประวัติการแก้ไข 2013-10-24 08:54:24
 |
 |
 |
 |
Date :
2013-10-24 08:52:28 |
By :
mangkunzo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|