[PHP-users 22826]jpgraph errorについて

takahiro_enomoto @ mhi.co.jp takahiro_enomoto @ mhi.co.jp
2004年 7月 27日 (火) 07:47:26 JST





jpgraphを使用し始めたばかりのど素人です。
一つ質問をさせて下さい。
以下<? ?>で囲まれたphp部分だけを実行するとうまくグラフが作成
されます。ところが以下ソース全てを実行すると以下エラーがでて
うまく表示されません。

どうすればうまく表示されるのでしょうかご教授願います。

〜ソース〜

<html>
<title>Tivoli ITM_DB</title>
<head></head>
<body>

<?
include ("jpgraph.php");
include ("jpgraph_line.php");
$ydata = array(11,3,8,10,5,1,9,13,5,7);

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

// Setup margin and titles
$graph->img->SetMargin(40,20,20,40);
$graph->title->Set("Example 2");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");

// Create the linear plot
$lineplot=new LinePlot($ydata);

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

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

</body>
</html>

〜エラー内容〜

JpGraph Error: HTTP headers have already been sent.
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".




PHP-users メーリングリストの案内