jpgraph操作

include ("../jpgraph.php"); 

include(
"../jpgraph_bar.php"); 

include (
"../jpgraph_line.php"); 

设置显示的数据数组; 

调用类库 

//设置图像的大小 

$graph = new Graph(400,200,"auto"); 

$graph->SetScale("textlin"); 

//设置图形的边距 

$graph->img->SetMargin(40,180,40,40); 

//设置图形的背景图片,填充方式有:BGIMG_FILLPLOT, BGIMG_FILLFRAME, BGIMG_COPY 

$graph->SetBackgroundImage("abc.jpg",BGIMG_FILLPLOT); 

$graph->img->SetAngle(45); //设置图形在图像中的角度 

//设置背景图片的对比度,must be between -1 <= x <= 1, (0,0)=original image 

$graph->AdjBackgroundImage(0,0); 

//设置投影; 

//$graph->SetShadow(); 

//设置标题 

$graph->title->Set("test image"); 

//设置标题字体样式 

$graph->title->SetFont(FF_FONT1,FS_BOLD); 

//设置标题的边距 

$graph->title->SetMargin(3); 

//设置图列的位置 

$graph->legend->Pos(0.05,0.5,"right","center"); 

//设置图列的投影,颜色 

$graph->legend->SetShadow('darkgray@0.1'); 

$graph->legend->SetFillColor('lightblue@0.3'); 

//设置x轴的标记 

$graph->xaxis->SetTickLabels($label_x); 

//设置X轴的显示值的角度; 

$graph->xaxis->SetLabelAngle(30); 

//设置x轴标题和字体颜色 

$graph->xaxis->title->Set('Year 2006'); 

$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); 

$graph->xaxis->title->SetColor('white'); 

//设置x轴的字体和颜色 

$graph->xaxis->SetFont(FF_FONT1,FS_BOLD); 

$graph->xaxis->SetColor('yellow'); 

//设置y轴的字体和颜色 

$graph->yaxis->SetFont(FF_FONT1,FS_BOLD); 

$graph->yaxis->SetColor('yellow'); 

//设置是否显示格子。默认为显示; 

//$graph->ygrid->Show(false); 

//设置格子的颜色和粗细。值越小,格子越粗。 

$graph->ygrid->SetColor('yellow@0.5'); 

//设置y轴更优美一些 

$graph->yaxis->scale->SetGrace(20); 



//设置图列的数据 

$bplot1 = new BarPlot($datay1); 

$bplot2 = new BarPlot($datay2); 

//设置图列的填充颜色 

$bplot1->SetFillColor('orange@0.4'); 

$bplot2->SetFillColor('brown@0.4'); 

设置值的格式 

$bplot1
->value->SetFormat('%d'); 

//设置图列标签 

$bplot1->SetLegend('Label 1'); 

$bplot2->SetLegend('Label 2'); 

//设置图列在图中的阴影 

$bplot1->SetShadow('black@0.4'); 

$bplot2->SetShadow('black@0.4'); 

//生成图列 

$gbarplot = new GroupBarPlot(array($bplot1,$bplot2)); 

$gbarplot->SetWidth(0.9); 

$graph->Add($gbarplot); 

//生成图形 

$graph->Stroke(); 

//上面所说的时在生成柱形图,当生成线性图时用下面的方法 

$p1 = new LinePlot($datay); 

$p1->mark->SetType(MARK_FILLEDCIRCLE); 

$p1->mark->SetFillColor("red"); 

$p1->mark->SetWidth(4); 

$p1->SetColor("blue"); 

$p1->SetCenter(); 

$p1->SetLegend("Triumph Tiger -98"); 

$graph->Add($p1); 



$p2 = new LinePlot($data2y); 

$p2->mark->SetType(MARK_STAR); 

$p2->mark->SetFillColor("red"); 

$p2->mark->SetWidth(4); 

$p2->SetColor("red"); 

$p2->SetCenter(); 

$p2->SetLegend("New tiger -99"); 

$graph->Add($p2); 



// Style can also be specified as SetStyle([1|2|3|4]) or 
// SetStyle("solid"|"dotted"|"dashed"|"lobgdashed") 
$lineplot->SetStyle("dashed");//设置线的样式 



$graph->yaxis->scale->SetGrace(20); //设置y轴更优美一些 

2.柱形图和饼状图举例 

if($tag == 1



$graph = new Graph(600,400,"auto"); 

$graph->SetScale("textlin"); 

$graph->setMarginColor('lightblue'); 

$graph->SetShadow(); 

$graph->setMargin(30,100,30,60); 

//设置标题; 

$graph->title->set("文章分类汇总"); 

$graph->title->SetMargin(3); 

$graph->title->setfont(FF_SIMSUN,FS_BOLD); 

$graph->title->setcolor('black@0.5'); 



$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD); 

$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD); 

$graph->xaxis->SetFont(FF_SIMSUN,FS_NORMAL); 

$graph->xaxis->SetColor('darkblue','black'); 

$graph->xaxis->SetTickLabels($name); 

$graph->xaxis->SetLabelAngle(30); 

$bplot = new BarPlot($article_num); 

$bplot->SetFillColor("orange"); 

$bplot->value->SetFormat('%d'); 

$bplot->SetShadow('darkgray'); 

$bplot->value->show(); 

$graph->legend->SetFont(FF_SIMSUN,FS_BOLD); 

$bplot->SetLegend("文章数"); 

$graph->Add($bplot); 

$graph->Stroke(); 



else 



$graph1 = new PieGraph(600,400,"auto"); 

$graph1->SetScale("textlin"); 

$graph1->SetShadow(); 

$graph1->title->setFont(FF_SIMSUN,FS_BOLD); 

$graph1->title->set("用户文章饼形图"); 

$graph1->setMargin(30,100,30,60); 

$p1 = new pieplot3d($article_num); 

$p1->setAngle(80); 

$p1->setsize(0.5); 

$p1->setShadow(); 

$p1->ExplodeSlice(2); 

$p1->SetCenter(0.4); 

$graph1->legend->SetFont(FF_SIMSUN,FS_NORMAL); 

$graph1->legend->setshadow(); 

$p1->SetLegends($name); 

$graph1->Add($p1); 

$graph1->Stroke(); 




//生成本地图片 

$graph->Stroke("路径/文件名.png");
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值