140
4.5.1.3.36 Halaman Grafik Jenis Kelamin Penduduk
Gambar 4.40 Halaman Grafik Jenis Kelamin Penduduk Halaman grafik jenis kelamin penduduk ini gambar 4.40
menampilkan data jenis kelamin penduduk kampung yang dibagi menjadi 2 jenis yaitu laki-laki dan perempuan. Berikut ini adalah listing program untuk
menampilkan grafik jenis kelamin penduduk:
?php include_once .libMysqlConn.php;
sql = new MysqlConn; sql2 = new MysqlConn;
smtThn = array; ip = array;
include .libjpgraphjpgraph.php; include .libjpgraphjpgraph_bar.php;
include .libjpgraphjpgraph_line.php; str = SELECT countnik as jk from penduduk where
jenis_kel=L; sql-executestr;
data = sql-getArrayAssoc; str2 = SELECT countnik as jk from penduduk where
jenis_kel=P; sql2-executestr2;
141
data2 = sql2-getArrayAssoc; array_unshiftsmtThn, Laki-laki, Perempuan;
array_unshiftip, data[jk],data2[jk]; graph = new Graph500,300,auto;
graph-SetScaletextlin, 0, 100; graph-SetShadow;
graph-SetMargin50,50,40,40; barplot = new BarPlotip;
barplot-SetFillColorred; barplot-value-show;
barplot -value-SetFormat3.1f; graph-Addbarplot;
graph-xaxis- SetTickLabelssmtThn; graph-title-SetGrafik Jenis Kelamin Penduduk;
graph-yaxis-title-SetJumlah Penduduk; graph-title-SetFontFF_FONT1,FS_BOLD;
graph-yaxis-title-SetFontFF_FONT1,FS_BOLD; graph-xaxis-title-SetFontFF_FONT1,FS_BOLD;
graph-Stroke; ?
Listing Program 4.38 pendudukjk.php
4.5.1.3.37 Halaman Grafik Pekerjaan Penduduk
Gambar 4.41 Halaman Grafik Pekerjaan Penduduk
142 Halaman grafik pekerjaan penduduk ini gambar 4.41 menampilkan
data jenis pekerjaan penduduk kampung yang dibagi menjadi 4 jenis yaitu petani, PNS, pegawai dan wiraswasta. Berikut ini adalah listing program untuk
menampilkan grafik pekerjaan penduduk:
?php include_once .libMysqlConn.php;
sql = new MysqlConn; sql2 = new MysqlConn;
sql3 = new MysqlConn; sql4 = new MysqlConn;
smtThn = array; ip = array;
include .libjpgraphjpgraph.php; include .libjpgraphjpgraph_bar.php;
include .libjpgraphjpgraph_line.php; str = SELECT countnik as pekerjaan from penduduk where
pekerjaan=Petani; sql-executestr;
data = sql-getArrayAssoc; str2 = SELECT countnik as pekerjaan from penduduk where
pekerjaan=PNS; sql2-executestr2;
data2 = sql2-getArrayAssoc; str3 = SELECT countnik as pekerjaan from penduduk where
pekerjaan=Pegawai; sql3-executestr3;
data3 = sql3-getArrayAssoc; str4 = SELECT countnik as pekerjaan from penduduk where
pekerjaan=Wiraswasta; sql4-executestr4;
data4 = sql4-getArrayAssoc; array_unshiftsmtThn, Petani, PNS, Pegawai, Wiraswasta;
array_unshiftip, data[pekerjaan],data2[pekerjaan],data3[pekerjaan],data4[
pekerjaan]; graph = new Graph500,300,auto;
graph-SetScaletextlin, 0, 100; graph-SetShadow;
graph-SetMargin50,50,40,40; barplot = new BarPlotip;
barplot-SetFillColorred; barplot-value-show;
barplot -value-SetFormat3.1f; graph-Addbarplot;
graph-xaxis- SetTickLabelssmtThn; graph-title-SetGrafik Pekerjaan Penduduk;
143
graph-yaxis-title-SetJumlah Penduduk; graph-title-SetFontFF_FONT1,FS_BOLD;
graph-yaxis-title-SetFontFF_FONT1,FS_BOLD; graph-xaxis-title-SetFontFF_FONT1,FS_BOLD;
graph-Stroke; ?
Listing Program 4.39 pendudukkerja.php
4.5.1.3.38 Halaman Data