Forum: PC-Programmierung PHP Array -> phpplot funktion nutzen


von Patti (Gast)


Lesenswert?

Ich bin gerade am experimentieren mit phplot. Nun habe ich Werte in 
einer TXT und lese dies in ein Array ein. Nun möcht ich diese Werte in 
einem Array benutzen, das die Koordinaten für das Diagramm bereitstellt.
In der TXT habe ich zb. 11 stehen und der Wert wird mir auch ausgegeben 
wenn ich mir nur $lines [0] anzeigen lasse.
Wo liegt mein Denkfehler?
Danke Euch :-)

<?php
# PHPlot Example: Simple line graph
require_once 'Diagramm/phplot.php';
$lines = file ('Messdaten.txt');
$data = array(
  array('', 1800,   $lines[0] ), array('', 1810,   12), array('', 1820, 
10),
  array('', 1830,  13), array('', 1840,  17), array('', 1850,  23),
  array('', 1860,  31), array('', 1870,  39), array('', 1880,  50),
  array('', 1890,  63), array('', 1900,  76), array('', 1910,  92),
  array('', 1920, 106), array('', 1930, 123), array('', 1940, 132),
  array('', 1950, 151), array('', 1960, 179), array('', 1970, 203),
  array('', 1980, 227), array('', 1990, 249), array('', 2000, 281),
);

$plot =& new PHPlot(800, 600);
$plot->SetImageBorderType('plain');

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

# Main plot title:
$plot->SetTitle('');

# Make sure Y axis starts at 0:
$plot->SetPlotAreaWorld(NULL, 0, NULL, NULL);

$plot->DrawGraph();
?>

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.