I am working on a resource management project, to take the current
Excel spreed sheet and move it over to a web based database driver
application. I choose cakephp for the ease of use and the prototyping
(scaffolding), I have created all the database tables required and run
the scaffolding to create all the components, models and views that i
needed, so far so good. I implemented a user login process, "now users
can login to see what project they been assigned to".

Were I run into a wall was with how to do the reporting and show
graphs from the data that is stored in the database. There are a
number of graphs I would like to do.

1. Gant chart showing the projects time line (gant chart)
2. Demand/utilization/capacity chart (line chart)
3. Availability graphs (line chart)
4. Resource Types availability chart (line chart)

I started of looking for a library, i read articles in the bakery
about JpGraph and Open Flash Chart, I tried the examples out and I
could not get them to show any graphs. Trying the JpGraph sample, i
created a controller named ReportsController.

======================== start code snippet controller
====================================
<?php
class ReportsController extends AppController
{
        var $name = 'Reports';

function index() {
                $this->layout='ajax';
                $graphdata = array(0 => 455.36, 1 => 464.47, 2 => 473.76, 3 =>
483.23, 4 => 492.9, 5 => 502.75 );
                $this->set('graphdata',$graphdata);
}
?>
======================= end code snippet controller
==================================

A simple example that I got from the article using JpGraph -
http://bakery.cakephp.org/articles/view/using-jpgraph


======================== start code snippet view
======================================
<div class="projects index">
<h2><?php __('Reports');?></h2>
<p>

<?php
header("Content-Type: image/png"); //this is the added line
App::import('Vendor', 'jpgraph/jpgraph');
App::import('Vendor', 'jpgraph/jpgraph_pie');
?>

<?php
// Create the Pie Graph.
$graph = new PieGraph(1000,950,"auto");
$graph->SetShadow();
$graph ->legend->Pos( 0.25,0.8,"right" ,"bottom");
$graph->legend->SetFont(FF_VERDANA,FS_BOLD,12);
$graph->title->SetMargin (20);

// Set A title for the plot
$graph->title->Set("Full Report");
$graph->title->SetFont(FF_VERDANA,FS_BOLD,24);
//students
$graph->subtitle->Set("(n=$total)");
$graph->subtitle->SetFont(FF_VERDANA,FS_BOLD,8);


// Create plots
$size=0.13;
$p1 = new PiePlot($data1);
$p1->SetLegends(array("1 - Not Yet","2","3 - Emerging","4","5 -
Somewhat","6","7 - Completely","Blank (No Answer)"));
$p1->SetSize($size);
$p1->SetGuideLines(true,false);
$p1->SetGuideLinesAdjust(1.1,3);
$p1->SetCenter(0.25,0.32);
$p1->value->SetFont(FF_VERDANA);
$p1->title->Set("Positive Social Emotional Skills");
$p1->title->SetMargin(45);
$p1-
>SetSliceColors(array('red','orange','yellow','green','purple','blue','brown','black'));


$p2 = new PiePlot($data2);
$p2->SetSize($size);
$p2->SetGuideLines(true,false);
$p2->SetGuideLinesAdjust(1.1,3);
$p2->SetCenter(0.65,0.32);
$p2->value->SetFont(FF_VERDANA);
$p2->title->Set("Acquisition and Use of Knowledge and Skills");
$p2->title->SetMargin(45);
$p2-
>SetSliceColors(array('red','orange','yellow','green','purple','blue','brown','black'));


$p3 = new PiePlot($data3);
$p3->SetSize($size);
$p3->SetGuideLines(true,false);
$p3->SetGuideLinesAdjust(1.1,3);
$p3->SetCenter(0.25,0.75);
$p3->value->SetFont(FF_VERDANA);
$p3->title->Set("Use of Appropriate Behaviors to Meet Needs");
$p3->title->SetMargin(45);
$p3-
>SetSliceColors(array('red','orange','yellow','green','purple','blue','brown','black'));



$graph->Add($p1);
$graph->Add($p2);
$graph->Add($p3);

$graph->Stroke();
?>

======================== start code snippet view
======================================

I do not know what I am doing wrong, as I do not get any graph to
show. I was hoping someone has an idea on what I am doing worng.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to