Hi!

If I call another model then jpgraph gives error image can not be
displayed.Even if I create model for that controller,it also gives error.How
to add another model data in jpgraph?

On Wed, Feb 16, 2011 at 2:34 PM, sanjib dhar <[email protected]>wrote:

>
> controller:
>
> <?php
> class GraphsController extends AppController {
>
> var $name = 'Graphs';
> var $uses = array();
>  function example6() {
> $this->layout='';
>  }
> }
> ?>
>
> view:
> <?php
> App::import('Vendor', 'jpgraph/jpgraph');
> App::import('Vendor', 'jpgraph/jpgraph_bar');
>
> $data1y=array(12,8,19,3,10,5);
> $data2y=array(8,2,11,7,14,4);
>
> // Create the graph. These two calls are always required
> $graph = new Graph(310,200);
> $graph->SetScale("textlin");
>
> $graph->SetShadow();
> $graph->img->SetMargin(50,10,10,10);
>
> // Create the bar plots
> $b1plot = new BarPlot($data1y);
> $b1plot->value->SetFormat('%d');
>
> $b1plot->value->SetAlign('left','center');
> $b1plot->value->SetColor('black','darkred');
>
>
> $b2plot = new BarPlot($data2y);
> $b2plot->value->SetFormat('%d');
> $b2plot->value->SetAlign('left','center');
>
> $b2plot->value->SetColor('black','darkred');
>
>
> // Create the grouped bar plot
> $gbplot = new GroupBarPlot(array($b1plot,$b2plot));
>
> // ...and add it to the graPH
> $graph->Add($gbplot);
> $ydata = array(11,3,8,42,5,1,9,13,5,7);
> $datax =
> array("Jan","Feb","Mar","Apr","Maj","Jun","Jul","aug","Sep","Oct");
> $graph->xaxis->SetTickLabels($datax);
> $graph->title->Set("Example 21");
> $graph->xaxis->title->Set("X-title");
> $graph->yaxis->title->Set("Y-title");
> $graph->title->SetFont(FF_FONT1,FS_BOLD);
> $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
> $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
> $graph->xaxis->SetLabelAngle(0);
> $graph->yaxis->scale->SetGrace(20);
> $b1plot->value->Show();
> $b2plot->value->Show();
> // Display the graph
> $graph->Stroke();
> ?>
>
> $b1plot->value->Show();
> $b2plot->value->Show();
> These code should be in the just before $graph->Stroke(); that's the
> trick.I was doing mistake by putting Show() before $graph->Add($gbplot);
>
> Although the post is not right place to discuss this one but it may help
> the developer.
>
> On Wed, Feb 16, 2011 at 2:14 PM, Jeremy Burns | Class Outfit <
> [email protected]> wrote:
>
>> Well said.
>>
>> Jeremy Burns
>> Class Outfit
>>
>> [email protected]
>> http://www.classoutfit.com
>>
>> On 16 Feb 2011, at 08:42, Dr. Tarique Sani wrote:
>>
>> > On Wed, Feb 16, 2011 at 2:07 PM, sanjib dhar <[email protected]>
>> wrote:
>> >> solved.
>> >>
>> >
>> > Please,
>> >
>> > Even if you have solved it - it would be nice if you post how you
>> > solved it. It would be help someone in the future.
>> >
>> > Don't just take - give back as well.
>> >
>> > Cheers
>> > Tarique
>> >
>> >
>> > --
>> > =============================================================
>> > PHP for E-Biz: http://sanisoft.com
>> > =============================================================
>> >
>> > --
>> > Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> > Check out the new CakePHP Questions site http://ask.cakephp.org and
>> help others with their CakePHP related questions.
>> >
>> >
>> > To unsubscribe from this group, send email to
>> > [email protected] For more options, visit this
>> group at http://groups.google.com/group/cake-php
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>
>
> --
> *Be Smile Always *
> *SANJIB*
>
>


-- 
*Be Smile Always *
*SANJIB*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to