<?php header('connect-type:text/html; charset=utf-8'); include 'conn.php'; $sql = "select xy_id,count(1) as counts from stu_inf group by xy_id"; $r = $conn -> 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","全校學(xué)生數(shù)量")); $graph->xaxis->title->Set(iconv("utf-8","gb2312","學(xué)院")); $graph->xaxis->SetTickLabels($xy); $graph->yaxis->title->Set(iconv("utf-8","gb2312",'人數(shù)')); $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(); ?>
專注于為中小企業(yè)提供網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)根河免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千多家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
數(shù)據(jù)庫連接:conn.php
<?php define('DB_HOST', 'localhost'); define('DB_USER', 'root'); define('DB_PASSWORD', ''); define('DB_DATABASE','db_student'); $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD,DB_DATABASE) or die("連接數(shù)據(jù)庫數(shù)據(jù)庫:
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)當(dāng)前題目:PHP+jpgraph實(shí)現(xiàn)柱型圖表,但是橫坐標(biāo)顯示為框框,不知是何原因
分享鏈接:http://aaarwkj.com/article24/pchhje.html成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站維護(hù)、網(wǎng)站改版、虛擬主機(jī)、服務(wù)器托管、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)