Current location: Hot Scripts Forums » Programming Languages » PHP » JPgraph

JPgraph

Reply
  #1 (permalink)  
Old 10-23-07, 02:08 AM
sandy1028 sandy1028 is offline
Newbie Coder
 
Join Date: Oct 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
JPgraph

Hi,

I have set the width as 850.
PHP Code:
$graph = new Graph(850,250,"auto");

$graph->SetScale("textlin",0,$max); 
How can I set the width as 250px and plot the values of array limit to 125px.

I want the width and height as 850 and 250. but the graph drawn should not cover the 250 spacing it should plot only till 125px.

How can I adjust the width and scaling to it

Last edited by Christian; 10-23-07 at 03:39 AM. Reason: Please use [PHP] tags when posting PHP code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-23-07, 06:07 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community VIP
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 2,724
Thanks: 0
Thanked 0 Times in 0 Posts
you will have to post the Graph class source or a link to the Graph class documentation before we can help you any further
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

If you want to add me on any IM, pm me first
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-23-07, 10:05 PM
sandy1028 sandy1028 is offline
Newbie Coder
 
Join Date: Oct 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

I want the graph to look lik this.
The graph is attached is implemented in gdlib.
I am trying to implement the same in JPgraph.

I want to set the graph width manually.Please help me how can I proceed with it



PHP Code:
include ("/var/www/jpgraph-1.19/jpgraph.php");
include (
"/var/www/jpgraph-1.19/jpgraph_line.php");

$ydata = array(11,280,57,10,7,100,200,54,100,5,1,9,13,5,7,45,11,3,8,12,45,53,56,11,34,57,10,7,34,23,54,100,5,1,9,13,5,7,45,11,3,8,12,45,53,56,11,34,57,10,7,34,23,54,100,5,1,9,13,5,7,45,11,3,8,12,45,53,56,11,34,57,10,7,34,23,54,100,5,1,9,13,5,7,45,11,3,8,12,45,53,56,11,34,57,10,7,34,23,54,10,10,10,10,10,10,10,45,11,3,8,12,45,53,56,11,34,57,10,7,34,23,54,100,5,1,9,13,5,7,45,11,3,8,12,45,53,56,45,53,56,11,34,57,10,7,34,200,5);
$max=max($ydata);
$graph = new Graph(620,200,"auto");
$graph->SetScale("textlin",0,$max);
$graph->img->SetMargin(40,40,40,40);
$lineplot = new LinePlot($ydata);
$lineplot->SetColor("red");
$graph->xaxis-> title->Set("Time(hr)--------->" );
$graph->yaxis-> title->Set("%---------------->" );

$graph->title->SetFont(FF_FONT1,FS_BOLD);

$graph->SetMarginColor("red");
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$lineplot->SetLegend("Value Up");
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(.5,.9,"center","right");
$graph->legend->SetFillColor("lemonchiffon2:1.3");
$graph->yaxis->SetColor("red","black");
$graph->xaxis->SetColor("red","black");
$graph->xaxis->SetTickLabels($hours);
$graph->xaxis->SetTextLabelInterval(2);
$graph->xaxis->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->SetTextTickInterval(6);
$graph->yaxis->SetTextLabelInterval(2);
$graph->yaxis->HideFirstLastLabel();
$graph->SetBackgroundGradient('lemonchiffon','white',GRAD_MIDHOR,BGRAD_PLOT);
$graph->SetMarginColor('lemonchiffon2:1.3');
$graph->ygrid->SetColor('orange');
ddText($txt);

$graph->Add($lineplot);
//$graph->Add($lineplot2);
$graph->Stroke(); 
Attached Images
 

Last edited by Christian; 10-23-07 at 11:39 PM. Reason: Please use [php] tags!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-24-07, 02:09 AM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 759
Thanks: 1
Thanked 1 Time in 1 Post
Do you mean settings the Margins?
PHP Code:
$graph = new Graph(850250) ;
$graph->SetMargin(x1y1x2y2) ; 
Untested. Not totally sure on this.
Let us know how you get on...
__________________
01010000 01001000 01010000
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-24-07, 03:06 AM
sandy1028 sandy1028 is offline
Newbie Coder
 
Join Date: Oct 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
SetMargin is to set the area.

But I want the graph to be plotted within the specified area.

Supppose width is 250px I want the width to plot with in 125px but the width should be 250px
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 10-24-07, 11:20 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,029
Thanks: 14
Thanked 34 Times in 33 Posts
I'd recommend asking this question in the JPGraph Help Forum.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data (scroll down)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding TTF fonts in the JpGraph rsuresh PHP 1 06-24-04 02:48 AM
SQL and jpgraph 1.15 Worm PHP 0 06-16-04 09:12 AM
Jpgraph rsuresh PHP 1 06-15-04 03:37 AM
Jpgraph Dynamic rrdlopes PHP 1 02-03-04 10:19 AM
jpGraph axis labeling problem Squeezer PHP 2 08-20-03 07:53 AM


All times are GMT -5. The time now is 07:37 PM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.