<?php
//以下为include文件.你的路径一定要改对!
include("lib/jpgraph/jpgraph.php") ;
include("lib/jpgraph/jpgraph_line.php") ;//数据,数组形式的
$ydata=array(15,43,55,34,21,45); //Y轴
$xdata=array("one","two","three","four","five","six");//X轴$graph = new Graph(550, 250,"auto"); //创建对象
$graph->SetScale( "textlin"); $graph->xaxis->SetTickLabels($xdata);
$graph->ygrid->SetFill(true,'#0000aa:1.6','#0000cc:1.8');
$graph->SetBackgroundGradient('blue:1.5','blue:2.0',GRAD_VER,BGRAD_MARGIN);
//$graph->SetShadow();// Create the linear plot
$lineplot =new LinePlot($ydata); //创建line
$lineplot ->SetColor("red"); //设置颜色
$lineplot ->value->SetColor("#aa0000");//数据颜色
$lineplot ->value->SetFormat("%0.0f");//数据格式
$lineplot->value ->Show();$graph->Add( $lineplot); $graph->Stroke(); ;?>
//以下为include文件.你的路径一定要改对!
include("lib/jpgraph/jpgraph.php") ;
include("lib/jpgraph/jpgraph_line.php") ;//数据,数组形式的
$ydata=array(15,43,55,34,21,45); //Y轴
$xdata=array("one","two","three","four","five","six");//X轴$graph = new Graph(550, 250,"auto"); //创建对象
$graph->SetScale( "textlin"); $graph->xaxis->SetTickLabels($xdata);
$graph->ygrid->SetFill(true,'#0000aa:1.6','#0000cc:1.8');
$graph->SetBackgroundGradient('blue:1.5','blue:2.0',GRAD_VER,BGRAD_MARGIN);
//$graph->SetShadow();// Create the linear plot
$lineplot =new LinePlot($ydata); //创建line
$lineplot ->SetColor("red"); //设置颜色
$lineplot ->value->SetColor("#aa0000");//数据颜色
$lineplot ->value->SetFormat("%0.0f");//数据格式
$lineplot->value ->Show();$graph->Add( $lineplot); $graph->Stroke(); ;?>
gd下的jpgraph中有些函数不可用.
if (!defined('CACHE_DIR')) {
if (strstr( PHP_OS, 'WIN')) {
DEFINE('CACHE_DIR', $_SERVER['TEMP'] . '/');
} else {
DEFINE('CACHE_DIR','/tmp/jpgraph_cache/');
}
}
检查是否有相应路径