JpGraph Community
September 08, 2010, 12:42:19 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: problem with jpgraph installation  (Read 1205 times)
0 Members and 1 Guest are viewing this topic.
Walter
Newbie
*
Posts: 1



View Profile Email
« on: February 11, 2010, 03:49:32 pm »

Hello everyone
I am very new in php and jpgraph. So I'll try to explain as best as possible. First, I work on Windows XP but I'm connected to a Debian Linux server that have installed Apache and PHP. I download the file jpgraph-3.0.7.tar.bz2 and I unzipped. I found a src folder that contains many files, including file jpgraph.php. Then copy this folder to the folder /www/b033/ into Linux server. It is the only folder that I have access. Using Dreamweaver I created in the folder /www/b033/ a php file called "graphic" and in this file I paste one example I found among the files in the folder src. The graphic file code is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GRAFICO</title>
</head>
<body>
<?php
//phpinfo();
// content="text/plain; charset=utf-8"
require_once ('src/jpgraph.php');
require_once ('src/jpgraph_line.php');
// Some data
$ydata = array(11,3,8,12,5,1,9,13,5,7);
// Create the graph. These two calls are always required
$graph = new Graph(350,250);
$graph->SetScale('textlin');
// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot->SetColor('blue');
// Add the plot to the graph
$graph->Add($lineplot);
// Display the graph
$graph->Stroke();
?>
</body>
</html>

Then I go to my browser, enter the address http://b033.grupoxion.com/grafico.php and shows me the following message:

JpGraph Error: HTTP headers have already been sent.
Caused by output from file grafico.php at line 8.
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).
Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.
For example it is a common mistake to leave a blank line before the opening "<?php".

I have no idea because I get this.
Please I need your help, urgent.
Thank you very much.
Logged
jpgraph
Administrator
jpGraph Guru
*****
Posts: 1313


View Profile WWW
« Reply #1 on: February 15, 2010, 01:08:48 am »

Hi,

You really need to read the manual, especially the introductory parts on how to create images with PHP.

You cannot mix HTML and graphs. The graph script IS the image  and script can only send back image data.

All of this is thoroughly described in the manual (believe me -  I wrote it...)

/J
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.03 seconds with 17 queries.