How can I get a pchart
in a specific location on my HTML page? right now when I follow the example and use
$myPicture->autoOutput();
It just overwrites my entire page and just shows the graph.
Looking at the pChart
source I found inside pImage.class.php
a relevant function
function stroke()
{
if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); }
header('Content-type: image/png');
imagepng($this->Picture);
}
I tried to change it to this but it seems to return null and I'm getting a bunch of errors about
Warning: imagettfbbox() [function.imagettfbbox]: Invalid font filename in**
function stroke()
{
ob_start(NULL,4096);
$this->Picture;
header('Content-type: text/html');
return base64_encode(ob_get_clean();
}
the easiest way is to split your project into 2 seperate files. One file holds your webpage and the other creates the image (chart). Let's name the second files chart.php As you mentioned, it outputs only an image. What you need to do, is to embed this file into the first one, which holds the webpage.
Add <img src="chart.php" width="x" height="y" />
within your html code.
HtH, Thor