PHP+jpgraph实现柱型图表,但是横坐标显示为框框,不知是何原因-创新互联
query($sql);
$rs = array();
while ($row = mysqli_fetch_array($r)){
$rs[] = $row['counts'];
}
$sql_xy = "select * from xy_inf group by xy_id";
$r_xy = $conn -> query($sql_xy);
$xy = array();
while ($row_xy = mysqli_fetch_array($r_xy)){
$xy[] = $row_xy['stu_xy'];
}
require_once 'src/jpgraph.php';
require_once 'src/jpgraph_bar.php';
$graph = new Graph(600, 300);
$graph->SetScale('textlin');
$graph->SetShadow();
$graph->img->SetMargin(40, 30, 20, 40);
$barplot = new BarPlot($rs);
$graph->Add($barplot);
$barplot->value->Show();
$graph->title->Set(iconv("utf-8","gb2312","全校学生数量"));
$graph->xaxis->title->Set(iconv("utf-8","gb2312","学院"));
$graph->xaxis->SetTickLabels($xy);
$graph->yaxis->title->Set(iconv("utf-8","gb2312",'人数'));
$graph->title->SetFont(FF_SIMSUN, FS_BOLD);
$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->Stroke();
?>
网站栏目:PHP+jpgraph实现柱型图表,但是横坐标显示为框框,不知是何原因-创新互联
当前路径:http://scyanting.com/article/djsepj.html
数据库连接:conn.php
创新互联致力于互联网网站建设与网站营销,提供网站设计、成都网站建设、网站开发、seo优化、网站排名、互联网营销、微信平台小程序开发、公众号商城、等建站开发,创新互联网站建设策划专家,为不同类型的客户提供良好的互联网应用定制解决方案,帮助客户在新的全球化互联网环境中保持优势。数据库:
mysql> use db_student; mysql> desc stu_inf; +--------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+----------------+ | id | smallint(6) | NO | PRI | NULL | auto_increment | | stu_xh | varchar(8) | NO | UNI | NULL | | | stu_xm | varchar(40) | NO | | NULL | | | xb_id | smallint(6) | NO | MUL | NULL | | | xy_id | smallint(6) | NO | | NULL | | | stu_bj | varchar(4) | NO | | NULL | | +--------+-------------+------+-----+---------+----------------+ 6 rows in set (0.00 sec)mysql> desc xy_inf; +--------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+----------------+ | xy_id | smallint(6) | NO | PRI | NULL | auto_increment | | stu_xy | varchar(40) | NO | | NULL | | +--------+-------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec)另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站栏目:PHP+jpgraph实现柱型图表,但是横坐标显示为框框,不知是何原因-创新互联
当前路径:http://scyanting.com/article/djsepj.html