
10-23-07, 02:08 AM
|
|
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.
|

10-23-07, 06:07 AM
|
 |
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
|

10-23-07, 10:05 PM
|
|
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();
Last edited by Christian; 10-23-07 at 11:39 PM.
Reason: Please use [php] tags!
|

10-24-07, 02:09 AM
|
 |
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(850, 250) ;
$graph->SetMargin(x1, y1, x2, y2) ;
Untested. Not totally sure on this.
Let us know how you get on...
__________________
01010000 01001000 01010000
|

10-24-07, 03:06 AM
|
|
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
|

10-24-07, 11:20 AM
|
 |
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)
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|