[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_log.php');
|
---|
| 4 | require_once ('jpgraph/jpgraph_line.php');
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | $ydata = array(11,3,8,42,5,1,9,13,5,7);
|
---|
| 8 | $datax = array("Jan","Feb","Mar","Apr","Maj","Jun","Jul","aug","Sep","Oct");
|
---|
| 9 |
|
---|
| 10 | // Create the graph. These two calls are always required
|
---|
| 11 | $graph = new Graph(350,200);
|
---|
| 12 | $graph->SetScale("textlog");
|
---|
| 13 |
|
---|
| 14 | $graph->img->SetMargin(40,110,20,40);
|
---|
| 15 | $graph->SetShadow();
|
---|
| 16 |
|
---|
| 17 | $graph->ygrid->Show(true,true);
|
---|
| 18 | $graph->xgrid->Show(true,false);
|
---|
| 19 |
|
---|
| 20 | // Specify the tick labels
|
---|
| 21 | $a = $gDateLocale->GetShortMonth();
|
---|
| 22 | $graph->xaxis->SetTickLabels($a);
|
---|
| 23 | $graph->xaxis->SetTextLabelInterval(2);
|
---|
| 24 |
|
---|
| 25 | // Create the linear plot
|
---|
| 26 | $lineplot=new LinePlot($ydata);
|
---|
| 27 |
|
---|
| 28 | // Add the plot to the graph
|
---|
| 29 | $graph->Add($lineplot);
|
---|
| 30 |
|
---|
| 31 | $graph->title->Set("Examples 9");
|
---|
| 32 | $graph->xaxis->title->Set("X-title");
|
---|
| 33 | $graph->yaxis->title->Set("Y-title");
|
---|
| 34 |
|
---|
| 35 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 36 | $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 37 | $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 38 |
|
---|
| 39 | $lineplot->SetColor("blue");
|
---|
| 40 | $lineplot->SetWeight(2);
|
---|
| 41 |
|
---|
| 42 | $graph->yaxis->SetColor("blue");
|
---|
| 43 |
|
---|
| 44 | $lineplot->SetLegend("Plot 1");
|
---|
| 45 |
|
---|
| 46 | $graph->legend->Pos(0.05,0.5,"right","center");
|
---|
| 47 |
|
---|
| 48 | // Display the graph
|
---|
| 49 | $graph->Stroke();
|
---|
| 50 | ?>
|
---|