hi,
ich habe folgenes Script geschrieben um die jpgraph zutesten:
Code:
include("jpgraph-2.0/src/jpgraph.php");
include("jpgraph-2.0/src/jpgraph_line.php");
include("jpgraph-2.0/src/jpgraph_bar.php");
$g = new Graph(400,300,"auto");
$g->SetScale("textlin");
$g->SetY2Scale("lin");
$g->SetShadow();
$daten1 = array(50,100,125,30); # Y-Daten BarPlot 1
$b1 = new BarPlot($daten1); # Erzeugung des Bar-Objekts
$b1->SetFillColor("orange");
$b1->SetLegend("Zugänge");
$daten2 = array(23,75,80,10);
$b2 = new BarPlot($daten2);
$b2->SetFillColor("chartreuse3");
$b2->SetLegend("Abgänge");
$accbar = new AccBarPlot(array($b2,$b1));
$daten3 = array(140,150,155,135);
$l = new LinePlot($daten3);
$l->SetFillColor("azure2");
$l->SetLegend("Totals");
$g->Add($l);
$g->AddY2($accbar);
# Titel des Diagramms
$g->title->set("Chat Traffic");
# Was stellt die X-Achse dar?
$g->xaxis->title->set("Stunde");
# Was stellt die Y-Achse dar?
$g->yaxis->title->set("Anzahl User");
$g->Stroke();
Es kommt aber immer die folgende fehler meldung:
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".
Wo ist der Fehler ?
Was habe ich vergessen ?
Vielen Danke für jede Hilfe
jeroen