PHP生成折线图和饼图等
内容导读
收集整理的这篇技术教程文章主要介绍了PHP生成折线图和饼图等,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2344字,纯文字阅读大概需要4分钟。
内容图文
pchart类库下载(地址:http://pchart.sourceforge.net/documentation.php) , 下载过后其中也有相应的例子,供选择生成折线图
include("pChart/pData.class"); include("pChart/pChart.class"); // Dataset definition$DataSet = new pData;$DataSet->AddPoint(array(100,320,200,10,43),"Serie1");$DataSet->AddPoint(array(20190726,20190727,20190728,20190729,20190730),"Serie3");$DataSet->AddSerie("Serie1");$DataSet->SetAbsciseLabelSerie("Serie3");// Initialise the graph $Test = new pChart(700,230);$Test->setFontProperties("Fonts/tahoma.ttf",8);$Test->setGraphArea(85,30,650,200);$Test->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);$Test->drawRoundedRectangle(5,5,695,225,5,230,230,230);$Test->drawGraphArea(255,255,255,TRUE);$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2);$Test->drawGrid(4,TRUE,230,230,230,50);$Test->setFontProperties("Fonts/tahoma.ttf",6);$Test->drawTreshold(0,143,55,72,TRUE,TRUE);$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());$Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255);//生成图表$imageFile = "1.png";$Test->Render($imageFile);echo '<img src="'.$imageFile.'">';
生成饼图
<?php /* Example13: A 2D exploded pie graph */ // Standard inclusions include("pChart/pData.class"); include("pChart/pChart.class"); // Dataset definition $DataSet = new pData; $DataSet->AddPoint(array(100,320,200,10,43,417),"Serie1"); $DataSet->AddPoint(array("20190726","20190727","20190728","20190729","20190730","20190731"),"Serie2"); $DataSet->AddAllSeries(); $DataSet->SetAbsciseLabelSerie("Serie2"); // Initialise the graph $Test = new pChart(500,200); $Test->setFontProperties("Fonts/tahoma.ttf",8); $Test->drawFilledRoundedRectangle(7,7,293,193,5,240,240,240); $Test->drawRoundedRectangle(5,5,295,195,5,230,230,230); // Draw the pie chart $Test->AntialiasQuality = 0; $Test->setShadowProperties(2,2,200,200,200); $Test->drawFlatPieGraphWithShadow($DataSet->GetData(),$DataSet->GetDataDescription(),120,100,60,PIE_PERCENTAGE,8); $Test->clearShadow(); $Test->drawPieLegend(230,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250); $imageFile = 'example12.png'; $Test->Render($imageFile);echo '<img src="'.$imageFile.'">';?>
相关推荐:《PHP教程》
以上就是PHP生成折线图和饼图等的详细内容,更多请关注Gxl网其它相关文章!
内容总结
以上是为您收集整理的PHP生成折线图和饼图等全部内容,希望文章能够帮你解决PHP生成折线图和饼图等所遇到的程序开发问题。 如果觉得技术教程内容还不错,欢迎将网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。