Hi,

How is Jpgraph supposed to integrate with cakephp? In the controller or the 
view do i place the code to construct the jpgraph  ?
The old way is to display a jgraph with an image which is a call to another 
view but that way doesnt appear to work with currect cakephp.


The problem is that jpgraph examples for cakephp is for older versions and 
there is no update for jpgraph with newer cakephp versions that I can find. 
The only solution I have found is from the stackoverflow post.

The jpgraph does work if I place the graph code in the controller like the 
hack solution but that isnt how it is supposed to work according to the 
docs. I didnt get the  requestHandler as explained in the stackoverflow 
post to have any effect  but anyway I cant find anything in the cakephp 
docs.


http://bakery.cakephp.org/articles/cguyer/2007/12/26/using-jpgraph
http://stackoverflow.com/questions/9936890/cakephp-2-0-jpgraph

?php
App::import('Vendor', 'Jpgraphs/jpgraph');
App::import('Vendor', 'Jpgraphs/jpgraph_line');

$ydata = array(11,11,11);

// Create the graph.
$graph = new Graph(350,250);
$graph->SetScale("textlin");
$graph->img->SetMargin(30,90,40,50);
$graph->xaxis->SetFont(FF_FONT1,FS_BOLD);
$graph->title->Set("Example 1.1 same y-values");

// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot->SetLegend("Test 1");
$lineplot->SetColor("blue");
$lineplot->SetWeight(5);

// Add the plot to the graph
$graph->Add($lineplot);

// Display the graph
$graph->Stroke();



?>

// ]]>


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to