JpGraph Lineal Graph

时间:2012-11-22 18:51:43

标签: php jpgraph

我有下一个直线图: http://fsy.xtrweb.com/nixi/info_equipo/linea_graph.php 但我想要这样的东西(用油漆修改的图像): http://fsy.xtrweb.com/nixi/info_equipo/migrafica2.jpg 基本上,y轴反向,从11开始,以1结尾,x轴从1到22(其中这个值是极限)。在这些日子里,它只知道一支足球队的位置。 我有以下代码:

<?php
include("jpgraph/jpgraph.php");
include("jpgraph/jpgraph_line.php");
include("conexion.php");

$id=$_GET['id'];

$query2="SELECT nombre FROM equipos WHERE id='".$id."'"; 
$result2=mysql_query($query2) or die("Error: ".mysql_error());
$Rs2=mysql_fetch_array($result2);
    $nombre_equipo=$Rs2[0];

        $sSQL="SELECT puesto,jornada FROM clasificaciones WHERE equipo='".$nombre_equipo."'"; 
        $result=mysql_query($sSQL);

         while ($row=mysql_fetch_array($result)){
            $puesto[]=$row[puesto];
        }

//$datos1 = array(9, 5, 12, 11, 6, 10, 9, 11, 10, 4, 7, 3, 24);
//$datos2 = array(5, 7, 1, 11, 13, 4, 9, 6, 12, 7, 1, 4, 21);

$datos1 = $puesto;

$grafico = new Graph(400, 300, "auto");
$grafico->SetScale("textlin");

$grafico->SetBackgroundGradient('#FDFDFD','#FDFDFD');
$grafico->xgrid->Show(); 

$grafico->xaxis->title->Set("Jornada");
$grafico->yaxis->title->Set("Puesto");

$grafico->yaxis->scale->SetAutoMin(1);
$grafico->yaxis->scale->SetAutoMax(11);

$lineplot1 = new LinePlot($datos1);
$lineplot1->SetColor("red");
$lineplot1->SetLegend("Equipo"); 
$lineplot1->SetWeight(2); 
$grafico->legend->SetFillColor('#FDFDFD');



$grafico->Add($lineplot1);

$grafico->Stroke();

?>

谢谢!

0 个答案:

没有答案