Patti: PHPLOT funzt nicht mit MYSQL Abfrage Hilfe :-(

Beitrag lesen

Hallo liebes Forum,
sehe im Augendblick leider keinen Lösungsansatz. Ich habe ein Script indem ich eine DB abfrage und die Werte in einem ARRAY sichere. Diese Werte liegen als Zahlen von 0-1000 vor. Nun habe ich vor die Werte grafisch aufzubereiten mit phplot.

Leider funktioniert die Ausgabe als png nur allein. Sobald ich meine MYSQL - Abfrage mit verwende, werden nur Daten, ähnlich als ob ich mir ein Bild mit dem Editor anschaue angezeigt.

Kennt jemand das Problem? Seelbst ein funktionierendes Diagramm mit festen Werten funzt nicht mehr sobald ich die MYSQL abfrage mit reinbringe.

Hier mal der Code wegen PHPlot:

#PHPlot Example: Simple line graph
require_once 'Diagramm/phplot.php';
$data = array(
array('1', (int)$Lufttemperatur[0]),    array('2', (int)$Lufttemperatur[1]),    array('3', (int)$Lufttemperatur[3]),
array('4', (int)$Lufttemperatur[4]),    array('5', (int)$Lufttemperatur[5]),    array('6', (int)$Lufttemperatur[6]),
array('7', (int)$Lufttemperatur[7]),    array('8', (int)$Lufttemperatur[8]),    array('9', (int)$Lufttemperatur[9]),
array('10', (int)$Lufttemperatur[10]),    array('11', (int)$Lufttemperatur[11]),    array('12', (int)$Lufttemperatur[12]),
array('13', (int)$Lufttemperatur[13]),    array('14', (int)$Lufttemperatur[14]),    array('15', (int)$Lufttemperatur[15]),
array('16', (int)$Lufttemperatur[16]),    array('17', (int)$Lufttemperatur[17]),    array('18', (int)$Lufttemperatur[18]),
array('19', (int)$Lufttemperatur[19]),    array('20', (int)$Lufttemperatur[20]),    array('21', (int)$Lufttemperatur[21]),
array('22', (int)$Lufttemperatur[22]),    array('23', (int)$Lufttemperatur[23]),    array('24', (int)$Lufttemperatur[24]),

);

$plot =& new PHPlot(640, 420);
$plot->SetImageBorderType('plain');

$plot->SetPlotType('lines');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);

Let's use a new color for these bars:

$plot->SetDataColors('blue');
$plot->SetLineWidths(3);

Force bottom to Y=0 and set reasonable tick interval:

$plot->SetPlotAreaWorld(NULL, 0, NULL, NULL);
$plot->SetYTickIncrement(1);

Format the Y tick labels as numerics to get thousands separators:

$plot->SetYLabelType('data');
$plot->SetXTickIncrement(1);
$plot->SetYTickIncrement(1);

Main plot title:

$plot->SetTitle('Tagesdurchschnitts Temperatur ');

Y Axis title:

$plot->SetYTitle('Temperatur in °C');
$plot->SetXTitle('Uhr');

Draw both grids:

$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);  # Is default

Turn off X tick labels and ticks because they don't apply here:

$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');

$plot->DrawGraph();

Danke Euch.