Witam,
uzyłem klasy
http://jpgraph.net/ do tworzenia wykresów, plik z zawartoscia danego wykresu wyglada tak:
<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');
require_once ('stat/plik.php');
$datay1 = array(20
,15
,23
,15
,$suma,3
,78
,76
,34
,23
,24
,67
); $datay2 = array(12
,9
,42
,8
,1
,5
,17
,32
,24
,1
,78
,32
); $datay3 = array(5
,17
,32
,24
,1
,45
,23
,12
,64
,12
,4
,12
);
// Setup the graph
$graph = new Graph(710,300);
$graph->SetScale("textlin");
$theme_class=new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Stastyki pacjenta');
$graph->SetBox(false);
$graph->img->SetAntiAliasing();
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels(array('styczen','luty','marzec','kwiecien','maj','czerwiec','lipiec','sierpien','wrzesien','pazdziernik','listopad','grudzien')); $graph->xgrid->SetColor('#E3E3E3');
// Create the first line
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('Suma ocen');
// Create the second line
$p2 = new LinePlot($datay2);
$graph->Add($p2);
$p2->SetColor("#B22222");
$p2->SetLegend('Srednia ocena');
// Create the third line
$p3 = new LinePlot($datay3);
$graph->Add($p3);
$p3->SetColor("#FF1493");
$p3->SetLegend('Cos tam');
$graph->legend->SetFrameWeight(1);
// Output line
$graph->Stroke();
?>
potem na danej stronie odwołuje sie do niego <img src="plik.php">
Jednak mam tutaj array który musiałbym uzupełnić danymi i praktycznie każda dana z tego arraya powinna być odwołanie do mysql skad powinnien pobierać dane. Ale jak wstawiam kod:
define('DB_HOST','localhost'); define('DB_USER','szpital'); //wpisz nazwęużytkownika bazy danych define('DB_PASS','asdasd'); //wpisz hasło dla tego użytkownika
w ta klase to juz obrazek sie nie wyswietla jakis pomysł >?