Jump to content

jpgraph problems


ninedoors

Recommended Posts

Can anyone see what is wrong with my call to AdjBackgroundImage function.  If I take it out then it works fine.  But I would liek to be able to fade the image into the background so I kind of need it.  I tried to find the function in the jpgraph.php file but had no luck(there is a couple thousand lines of code so I'm not sure if I missed it).  Does anyone know if that function was remove for the 2.3 version?  I can't see it but maybe.  Anyways here's the code I'm using:

<?php

include ('C:\xampp\htdocs\PTL\jpgraph-2.3\src\jpgraph.php');
include ('C:\xampp\htdocs\PTL\jpgraph-2.3\src\jpgraph_bar.php');
include_once 'graphfunctions/mac1history.php';

$startdate = '2007-05-01';
$enddate = '2007-06-01';

//Some data
include 'config/PMAconfig.php';

//Connect to apache server(MySQL) and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

list ($xdata, $ydata) = mac1history($startdate, $enddate);

//format date for graph
$date = new DateTime($startdate);
$sdate = $date->format("M. j/y");

$date = new DateTime($enddate);
$edate = $date->format("M. j/y");

$finaldate = $sdate . ' to ' . $edate;

//New graph with a drop shadow
$graph = new Graph(600,300,'auto');
$graph->SetShadow();

//Use a "text" X-scale
$graph->SetScale("textlin");
$graph->img->SetMargin(50,30,50,60);
$graph->SetBackgroundImage("images/lauder.jpg",BGIMG_FILLFRAME);
$graph->AdjBackgroundImage(0.4, 0.7, -1);

//Specify X-labels
$graph->xaxis->SetTickLabels($xdata);
$graph->xaxis->SetLabelAngle(90);

// Set title and subtitle
$graph->title->Set("PTL History - MAC Line 1");
$graph->title->SetColor('navy');
$graph->subtitle->Set($finaldate);

//Use built in font
$graph->title->SetFont(FF_ARIAL,FS_BOLD);

//Create the bar plot
$bplot = new BarPlot($ydata);
$bplot->SetLegend("Eaches"); 
// Setup color for gradient fill style 
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_HOR);
//$b1->SetAbsWidth(6);
//$b1->SetShadow();

//The order the plots are added determines who's ontop
$graph->Add($bplot);

//Finally output the image
$graph->Stroke('graphs/maconehistory.jpeg');

?>

 

And the error code I get is Fatal error: Call to undefined method Graph::AdjBackgroundImage() in C:\xampp\htdocs\PTL\ptl-history1.php on line 36.

 

Thanks

Link to comment
Share on other sites

A quick search on the forums for the class produced this:

 

The function "adjbackgroundimage()" has been removed after the shift to GD2 since that function only worked for older pallette based images (that was the original scope for GD1) anyway. It is simply not feasible to do that kind of image manipulation on TrueColor images.

 

Rgds

Johan

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.