Thread: JPgraph
View Single Post
  #3 (permalink)  
Old 10-23-07, 11: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
File Type: jpg linegraph.jpg (4.7 KB, 82 views)

Last edited by Christian; 10-24-07 at 12:39 AM. Reason: Please use [php] tags!
Reply With Quote