JpGraph - array
Hej, jeg prøver at lave en graf over en række træningsøvelser. I min database har jeg to enkle kolonner: dato og weightJeg har fundet flg. start-kode (se nedenfor), som virker fint.
Det jeg selvfølgelig skal er at smide mine egne data ind i linierne:
$xdata = array("04-01","04-02","04-03","04-04","04-05","04-06");
$ydata = array(28,13,24,"",90,11);
<?php
include ( "jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_line.php");
// Some data
$xdata = array("04-01","04-02","04-03","04-04","04-05","04-06");
$ydata = array(28,13,24,"",90,11);
// Create the graph. These two calls are always required
$graph = new Graph(350, 250,"auto");
$graph->title->Set ('Benchpress');
$graph->SetScale( "textlin");
// Setup X-scale
$graph->xaxis->SetTickLabels($xdata);
// Setup axis-titles
$graph->xaxis->title->Set("Date");
$graph->yaxis->title->Set("KG");
// Create the linear plot
$lineplot =new LinePlot($ydata);
$lineplot ->SetColor("blue");
$lineplot-> mark->SetType(MARK_UTRIANGLE );
// Add the plot to the graph
$graph->Add( $lineplot);
// Display the graph
$graph->Stroke();
?>
Hvordan trækker jeg mine data ud - så det er lige til at smide ind. Går ud fra det er noget array, men det er bestemt ikke min stærke side :-s
