Jump to content

Graphing


newbiePHP

Recommended Posts

Hey guys,

 

$ydata  = array(53.814,53.815,53.8067,53.8059,53.807,53.7935,53.802,53.8062,53.8126,53.8143,53.8075,53.8066,53.8059 ); 
$xdata = array (-3.05544, -3.05542, -3.05452, -3.05176, -3.05493, -3.05712, -3.05591, -3.05591, -3.05591, -3.05592, -3.05572, -3.05474, -3.05197 );

// Create the graph. These two calls are always required 
$graph  = new Graph(350, 250,"auto");     
$graph->SetScale( "textlin"); 

// Create the linear plot 
$lineplot1 =new LinePlot($ydata);
$lineplot2 =new LinePlot($xdata); 
$lineplot1 ->SetColor("blue"); 

// Add the plot to the graph 
$graph->Add( $lineplot1);
$graph->Add( $lineplot2);  

// Display the graph 
$graph->Stroke(); 

 

I'm trying to graph this co-ordinates. Basically you take the first number from y data and the first from x data and thats you point..so

 

point1=(53.814,-3.05544)

point2=(53.815,-3.05542)

...etc

 

How do I go about doing this? The code prints out 2 different lines instead of just the one line.

 

Any help would be really appreciated!!

 

Thanks,

newbiePHP

Link to comment
https://forums.phpfreaks.com/topic/80271-graphing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.