ribbon iwa

Tutorial Grafik AnyChart Dengan Data Banyak Menggunakan PHP MySQL

Kembali lagi dengan kami, setelah beberapa hari kami kemudian masih membahas mengenai anychart, tetapi kali ini bagaimana menggunakan AnyChart dengan data yang banyak dan beberapa kondisi menggunkaan PHP MySQL.



dfdrTetap sebelum itu kami ingin menjelaskan spesifikasi chart yang akan kami buat dibawah, Berikut spesifikasi sistem yang kami maksud.

Read More:

  1. Membuat Grafik Highcharts Dengan Php MyAdmin Menggunakan Ajax Bootsrap
  2. Cara Menggunakan Google Chart (Line Chart) Pada PHP Part 1
  3. Cara Singkat Menggunakan AnyCharts Pada Website Anda
  4. Membuat Grafik AnyChart Dengan Php MySQL


"Aplikasi yang akan buat dibawah adalah aplikasi dimana kami mempunyia banyak data yang kami simpan kedalam database. Data databse yang kami miliki terdiri dari data dari bulan Januari sampai bulan 10. Pada database terdapat data atau kami menyebutnya data komplaint yang terdiri dari tiga status, yang pertama Not Process Complaint , Inprocess Complaint dan Close Complaint. Nah data yang akan kami panggil kedalam grafik highchart ini adalah data setiap bulannya, dimana setiap satu batang highchart bisa mendeteksi berapa total komplaint yang ada pada bulan tersebut, berapa komplain yang statusnya Not Process Complaint, In Process Complaint dan Closed Complaint, disamping highcharts ini bisa menghitung secara otomatis presentase data disetiap bulannya".

Langsung saja yang pertama buat databse terlebih dahulu, disini kami membuat database dengan nama anychart kemudian masukan struktur database dibawah ini.

 -- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 13 Nov 2018 pada 14.21
-- Versi server: 10.1.36-MariaDB
-- Versi PHP: 7.2.10

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `anychart`
--

-- --------------------------------------------------------

--
-- Struktur dari tabel `tblcomplaints`
--

CREATE TABLE `tblcomplaints` (
  `complaintNumber` int(11) NOT NULL,
  `facilityName` varchar(50) NOT NULL,
  `buildingName` varchar(50) NOT NULL,
  `regDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `status` varchar(25) DEFAULT NULL,
  `lastUpdationDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `tblcomplaints`
--

INSERT INTO `tblcomplaints` (`complaintNumber`, `facilityName`, `buildingName`, `regDate`, `status`, `lastUpdationDate`) VALUES
(3, 'Platform', 'Campus Building', '2018-01-21 04:41:41', 'closed', '2018-05-24 04:43:28'),
(4, 'Platform', 'Campus Building', '2018-01-21 04:41:41', 'in process', '2018-05-24 16:01:23'),
(5, 'Platform', 'Campus Building', '2018-01-21 04:41:41', 'in process', '2018-06-10 10:55:37'),
(6, 'Platform', 'Campus Building', '2018-01-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(7, 'Platform', 'Campus Building', '2018-01-21 04:41:41', 'in process', '2018-05-23 05:25:17'),
(8, 'Platform', 'Campus Building', '2018-01-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(9, 'Platform', 'Campus Building', '2018-01-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(10, 'Platform', 'Campus Building', '2018-01-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(11, 'Platform', 'Campus Building', '2018-02-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(12, 'Platform', 'Campus Building', '2018-02-21 04:41:41', 'in process', '2018-05-23 05:26:05'),
(13, 'Platform', 'Campus Building', '2018-02-21 04:41:41', 'in process', '2018-05-24 04:49:34'),
(14, 'Platform', 'Campus Building', '2018-02-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(15, 'Platform', 'Campus Building', '2018-02-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(16, 'Platform', 'Campus Building', '2018-02-21 04:41:41', 'in process', '2018-06-04 20:28:52'),
(17, 'Platform', 'Campus Building', '2018-02-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(18, 'Platform', 'Campus Building', '2018-02-21 04:41:41', 'in process', '2018-06-10 01:27:33'),
(19, 'Platform', 'Campus Building', '2018-02-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(20, 'Platform', 'Campus Building', '2018-02-21 04:41:41', 'closed', '2018-06-10 10:56:37'),
(21, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(22, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(24, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(25, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(26, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(27, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(28, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(29, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(30, 'Platform', 'Campus Building', '2018-03-21 04:41:41', NULL, '0000-00-00 00:00:00'),
(31, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(32, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(33, 'Platform', 'Campus Building', '2018-04-10 04:41:41', 'in process', '2018-05-24 04:50:26'),
(34, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(35, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(36, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(37, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(38, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(39, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(40, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(41, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(42, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(43, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(44, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(45, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(46, 'Platform', 'Campus Building', '2018-04-10 04:41:41', NULL, '0000-00-00 00:00:00'),
(47, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(48, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(49, 'Platform', 'Campus Building', '2018-05-20 04:41:41', 'in process', '2018-05-24 04:50:52'),
(50, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(51, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(52, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(53, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(54, 'Platform', 'Campus Building', '2018-05-20 04:41:41', 'in process', '2018-07-03 13:32:25'),
(55, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(56, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(57, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(58, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(59, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(60, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(61, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(62, 'Platform', 'Campus Building', '2018-05-20 04:41:41', NULL, '0000-00-00 00:00:00'),
(63, 'Window', 'Campus Building', '2018-05-24 04:52:08', NULL, '0000-00-00 00:00:00'),
(64, 'Window', 'Campus Building', '2018-05-26 17:09:55', NULL, '0000-00-00 00:00:00'),
(65, 'Window', 'Rectorat Building', '2018-05-26 17:27:34', NULL, '0000-00-00 00:00:00'),
(66, 'Proyektor', 'Campus Building', '2018-05-26 17:27:55', NULL, '0000-00-00 00:00:00'),
(67, 'Platform', 'Campus Building', '2018-05-31 21:41:41', NULL, '0000-00-00 00:00:00'),
(68, 'Platform', 'Campus Building', '2018-05-31 21:41:41', NULL, '0000-00-00 00:00:00'),
(69, 'Platform', 'Campus Building', '2018-05-31 21:41:41', NULL, '0000-00-00 00:00:00'),
(70, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(71, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(72, 'Platform', 'Campus Building', '2018-06-01 21:41:41', 'in process', '2018-05-23 21:50:52'),
(73, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(74, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(75, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(76, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(77, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(78, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(79, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(80, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(81, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(82, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(83, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(84, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(85, 'Platform', 'Campus Building', '2018-06-01 21:41:41', NULL, '0000-00-00 00:00:00'),
(86, 'Window', 'Campus Building', '2018-06-02 21:52:08', NULL, '0000-00-00 00:00:00'),
(87, 'Window', 'Campus Building', '2018-06-04 10:09:55', NULL, '0000-00-00 00:00:00'),
(88, 'Window', 'Rectorat Building', '2018-06-26 10:27:05', NULL, '0000-00-00 00:00:00'),
(89, 'Proyektor', 'Campus Building', '2018-06-05 10:27:55', NULL, '0000-00-00 00:00:00'),
(91, 'Platform', 'Campus Building', '2018-06-13 02:13:13', NULL, '0000-00-00 00:00:00'),
(92, 'Window', 'Campus Building', '2018-06-13 03:11:12', NULL, '0000-00-00 00:00:00'),
(93, 'Select Facility Name', 'Select Building Name', '2018-06-13 03:11:23', NULL, '0000-00-00 00:00:00'),
(94, 'Amplifier', 'Campus Building', '2018-06-13 03:11:34', NULL, '0000-00-00 00:00:00'),
(95, 'Proyektor', 'Rectorat Building', '2018-06-13 03:13:30', NULL, '0000-00-00 00:00:00'),
(96, 'Proyektor', 'Rectorat Building', '2018-06-13 03:17:07', NULL, '0000-00-00 00:00:00'),
(97, 'Window', 'Campus Building', '2018-06-20 14:52:08', NULL, '0000-00-00 00:00:00'),
(98, 'Window', 'Campus Building', '2018-06-21 03:09:55', NULL, '0000-00-00 00:00:00'),
(99, 'Window', 'Rectorat Building', '2018-06-22 03:27:05', NULL, '0000-00-00 00:00:00'),
(100, 'Proyektor', 'Campus Building', '2018-06-23 03:27:55', NULL, '0000-00-00 00:00:00'),
(101, 'Platform', 'Campus Building', '2018-06-23 19:13:13', NULL, '0000-00-00 00:00:00'),
(102, 'Window', 'Campus Building', '2018-06-24 20:11:12', NULL, '0000-00-00 00:00:00'),
(103, 'Select Facility Name', 'Select Building Name', '2018-06-24 20:11:23', NULL, '0000-00-00 00:00:00'),
(104, 'Amplifier', 'Campus Building', '2018-06-24 20:11:34', NULL, '0000-00-00 00:00:00'),
(105, 'Proyektor', 'Rectorat Building', '2018-06-25 20:13:30', NULL, '0000-00-00 00:00:00'),
(106, 'Proyektor', 'Rectorat Building', '2018-06-25 20:17:07', NULL, '0000-00-00 00:00:00'),
(107, 'Window', 'Campus Building', '2018-06-20 14:52:08', NULL, '0000-00-00 00:00:00'),
(108, 'Window', 'Campus Building', '2018-06-21 03:09:55', NULL, '0000-00-00 00:00:00'),
(109, 'Window', 'Rectorat Building', '2018-06-22 03:27:05', NULL, '0000-00-00 00:00:00'),
(110, 'Proyektor', 'Campus Building', '2018-06-23 03:27:55', NULL, '0000-00-00 00:00:00'),
(111, 'Platform', 'Campus Building', '2018-06-23 19:13:13', NULL, '0000-00-00 00:00:00'),
(112, 'Window', 'Campus Building', '2018-06-24 20:11:12', NULL, '0000-00-00 00:00:00'),
(113, 'Select Facility Name', 'Select Building Name', '2018-06-24 20:11:23', NULL, '0000-00-00 00:00:00'),
(114, 'Amplifier', 'Campus Building', '2018-06-24 20:11:34', NULL, '0000-00-00 00:00:00'),
(115, 'Proyektor', 'Rectorat Building', '2018-06-25 20:13:30', NULL, '0000-00-00 00:00:00'),
(116, 'Proyektor', 'Rectorat Building', '2018-06-25 20:17:07', NULL, '0000-00-00 00:00:00'),
(117, 'Platform', 'Campus Building', '2018-07-01 14:41:41', 'in process', '2018-07-23 14:50:52'),
(118, 'Platform', 'Campus Building', '2018-07-01 14:41:41', 'in process', '2018-07-23 14:50:52'),
(119, 'Platform', 'Campus Building', '2018-07-01 14:41:41', 'in process', '2018-07-23 14:50:52'),
(120, 'Platform', 'Campus Building', '2018-07-01 14:41:41', 'in process', '2018-07-23 14:50:52'),
(121, 'Platform', 'Campus Building', '2018-07-01 14:41:41', 'in process', '2018-07-23 14:50:52'),
(122, 'Platform', 'Campus Building', '2018-08-01 14:41:41', 'closed', '2018-08-23 14:50:52'),
(123, 'Platform', 'Campus Building', '2018-08-01 14:41:41', 'closed', '2018-08-23 14:50:52'),
(124, 'Platform', 'Campus Building', '2018-08-01 14:41:41', 'closed', '2018-08-23 14:50:52'),
(125, 'Platform', 'Campus Building', '2018-08-01 14:41:41', 'closed', '2018-08-23 14:50:52'),
(126, 'Platform', 'Campus Building', '2018-08-01 14:41:41', 'closed', '2018-08-23 14:50:52'),
(127, 'Platform', 'Campus Building', '2018-10-01 14:41:41', 'closed', '2018-10-23 14:50:52'),
(128, 'Platform', 'Campus Building', '2018-10-01 14:41:41', 'closed', '2018-10-23 14:50:52'),
(129, 'Platform', 'Campus Building', '2018-10-01 14:41:41', 'closed', '2018-10-23 14:50:52'),
(130, 'Platform', 'Campus Building', '2018-10-01 14:41:41', 'closed', '2018-10-23 14:50:52'),
(131, 'Platform', 'Campus Building', '2018-10-01 14:41:41', 'closed', '2018-10-23 14:50:52');

--
-- Indexes for dumped tables
--

--
-- Indeks untuk tabel `tblcomplaints`
--
ALTER TABLE `tblcomplaints`
  ADD PRIMARY KEY (`complaintNumber`);

--
-- AUTO_INCREMENT untuk tabel yang dibuang
--

--
-- AUTO_INCREMENT untuk tabel `tblcomplaints`
--
ALTER TABLE `tblcomplaints`
  MODIFY `complaintNumber` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=132;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 

Kedua buat file dengan nama config.php fil ini berfungsi sebagai koneksi kedalam database.

 <?php
// conection
define('DB_SERVER','localhost');
define('DB_USER','root');
define('DB_PASS' ,'');
define('DB_NAME', 'anychart');
$con = mysqli_connect(DB_SERVER,DB_USER,DB_PASS,DB_NAME);
// Check connection
if (mysqli_connect_errno())
{
 echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?> 

Ketiga Buat perintah untuk memanggil database, disini kami membuat perintah untuk memanggil jumlah data database per bulannya. kemudian kami membuat perintah untuk memanggil komplaint dengan status not process complaint, in process complaint dan closed complaint.

 <?php
    $status="";
    $tahun=date("Y");
    $total = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints where YEAR(regDate)='$tahun'");
    $data = mysqli_fetch_row($total);
    $totalall = $data[0];


    $hasil1 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='01' and YEAR(regDate)='$tahun'");
    $data1 = mysqli_fetch_row($hasil1);
    $jumlah1 = $data1[0];
    $percent1= $jumlah1 * $totalall /100 ;


    $hasil2 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='02' and YEAR(regDate)='$tahun'");
    $data2 = mysqli_fetch_row($hasil2);
    $jumlah2 = $data2[0];
    $percent2= $jumlah2 * $totalall /100 ;


    $hasil3 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='03' and YEAR(regDate)='$tahun'");
    $data3 = mysqli_fetch_row($hasil3);
    $jumlah3 = $data3[0];
    $percent3= $jumlah3 * $totalall /100 ;


    $hasil4 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='04' and YEAR(regDate)='$tahun'");
    $data4 = mysqli_fetch_row($hasil4);
    $jumlah4 = $data4[0];
    $percent4= $jumlah4 * $totalall /100 ;


    $hasil5 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='05' and YEAR(regDate)='$tahun'");
    $data5 = mysqli_fetch_row($hasil5);
    $jumlah5 = $data5[0];
    $percent5= $jumlah5 * $totalall /100 ;


    $hasil6 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='06' and YEAR(regDate)='$tahun'");
    $data6 = mysqli_fetch_row($hasil6);
    $jumlah6 = $data6[0];
    $percent6= $jumlah6 * $totalall /100 ;


    $hasil7 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='07' and YEAR(regDate)='$tahun'");
    $data7 = mysqli_fetch_row($hasil7);
    $jumlah7 = $data7[0];
    $percent7= $jumlah7 * $totalall /100 ;


    $hasil8 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='08' and YEAR(regDate)='$tahun'");
    $data8 = mysqli_fetch_row($hasil8);
    $jumlah8 = $data8[0];
    $percent8= $jumlah8 * $totalall /100 ;


    $hasil9 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='09' and YEAR(regDate)='$tahun'");
    $data9 = mysqli_fetch_row($hasil9);
    $jumlah9 = $data9[0];
    $percent9= $jumlah9 * $totalall /100 ;


    $hasil10 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='10' and YEAR(regDate)='$tahun'");
    $data10 = mysqli_fetch_row($hasil10);
    $jumlah10 = $data10[0];
    $percent10= $jumlah10 * $totalall /100 ;


    $hasil11 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='11' and YEAR(regDate)='$tahun'");
    $data11 = mysqli_fetch_row($hasil11);
    $jumlah11 = $data11[0];
    $percent11= $jumlah11 * $totalall /100 ;


    $hasil12 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='12' and YEAR(regDate)='$tahun'");
    $data12 = mysqli_fetch_row($hasil12);
    $jumlah12 = $data12[0];
    $percent12= $jumlah12 * $totalall /100 ;

    ?>



    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='01' and YEAR(regDate)='$tahun' and status is null");
    $num0 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='01' and YEAR(regDate)='$tahun' and status='$status'");
    $num2 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='01' and YEAR(regDate)='$tahun' and status='$status'");
    $num3 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End--> 


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='02' and YEAR(regDate)='$tahun' and status is null");
    $num4 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='02' and YEAR(regDate)='$tahun' and status='$status'");
    $num5 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='02' and YEAR(regDate)='$tahun' and status='$status'");
    $num6 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End--> 


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='03' and YEAR(regDate)='$tahun' and status is null");
    $num7 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='03' and YEAR(regDate)='$tahun' and status='$status'");
    $num8 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='03' and YEAR(regDate)='$tahun' and status='$status'");
    $num9 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='04' and YEAR(regDate)='$tahun' and status is null");
    $num10 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='04' and YEAR(regDate)='$tahun' and status='$status'");
    $num11 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='04' and YEAR(regDate)='$tahun' and status='$status'");
    $num12 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='05' and YEAR(regDate)='$tahun' and status is null");
    $num13 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='05' and YEAR(regDate)='$tahun' and status='$status'");
    $num14 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='05' and YEAR(regDate)='$tahun' and status='$status'");
    $num15 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->



    <!--Mulai-->
    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='06' and YEAR(regDate)='$tahun' and status is null");
    $num16 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='06' and YEAR(regDate)='$tahun' and status='$status'");
    $num17 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='06' and YEAR(regDate)='$tahun' and status='$status'");
    $num18 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='07' and YEAR(regDate)='$tahun' and status is null");
    $num19 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='07' and YEAR(regDate)='$tahun' and status='$status'");
    $num20 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='07' and YEAR(regDate)='$tahun' and status='$status'");
    $num21 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->



    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='08' and YEAR(regDate)='$tahun' and status is null");
    $num22 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='08' and YEAR(regDate)='$tahun' and status='$status'");
    $num23 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='08' and YEAR(regDate)='$tahun' and status='$status'");
    $num24 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->



    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='09' and YEAR(regDate)='$tahun' and status is null");
    $num25 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='09' and YEAR(regDate)='$tahun' and status='$status'");
    $num26 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='09' and YEAR(regDate)='$tahun' and status='$status'");
    $num27 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='10' and YEAR(regDate)='$tahun' and status is null");
    $num28 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='10' and YEAR(regDate)='$tahun' and status='$status'");
    $num29 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='10' and YEAR(regDate)='$tahun' and status='$status'");
    $num30 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='11' and YEAR(regDate)='$tahun' and status is null");
    $num31 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='11' and YEAR(regDate)='$tahun' and status='$status'");
    $num32 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='11' and YEAR(regDate)='$tahun' and status='$status'");
    $num33 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='12' and YEAR(regDate)='$tahun' and status is null");
    $num34 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='12' and YEAR(regDate)='$tahun' and status='$status'");
    $num35 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='12' and YEAR(regDate)='$tahun' and status='$status'");
    $num36 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End--> 

Keempat konfigurasi AnyChart dengan PHP, JavaScript untuk memanggil total komplain dan status kompliant.

 <script type="text/javascript">
anychart.onDocumentReady(function() {
  // create data set on our data
  var dataSet = anychart.data.set(getData());

  // map data for the first series
  var seriesData_1 = dataSet.mapAs({
    'x': 0,
    'value': 1
  });

  // map data for the second series
  var seriesData_2 = dataSet.mapAs({
    'x': 0,
    'value': 2
  });

  // map data for the second series
  var seriesData_3 = dataSet.mapAs({
    'x': 0,
    'value': 3
  });

  // map data for the second series
  var seriesData_4 = dataSet.mapAs({
    'x': 0,
    'value': 4
  });

  // create line chart
  var chart = anychart.column();

  // turn on chart animation
  chart.animation(true);

  chart.padding(10);

  // disable Y axis
  chart.yAxis(false);

  // set X axis title
  chart.xAxis()
    .title('Month')
    .stroke('black', 2);

  chart.xAxis().ticks()
    .enabled(false);

  // force chart to stack values by Y scale
  chart.yScale().stackMode('value');

  // set chart title
  chart.title('Total Dan Status Komplaint Selama Setahun (2018)');


  // create data-area and set background settings
  chart.dataArea()
    .background()
    .enabled(true)
    .fill('#456')
    .corners(25, 25, 0, 0);

  // set grid settings
  chart.xGrid()
    .stroke('#fff .1')
    .isMinor(true)
    .drawFirstLine(false)
    .drawLastLine(false);

  chart.yGrid()
    .stroke('#fff .1')
    .isMinor(true)
    .drawFirstLine(false)
    .drawLastLine(false);



  // create first series with mapped data
  var series_1 = chart.column(seriesData_1);
  series_1.name('Total');

  // create second series with mapped data
  var series_2 = chart.column(seriesData_2);
  series_2.name('Not Process');

  // create second series with mapped data
  var series_3 = chart.column(seriesData_3);
  series_3.name('In Process');


  // create second series with mapped data
  var series_4 = chart.column(seriesData_4);
  series_4.name('Closed');

  // turn the legend on
  chart.legend()
    .enabled(true)
    .fontSize(13)
    .fontColor('white')
    .positionMode('inside')
    .margin({
      top: 15
    });

  // set container id for the chart
  chart.container('container');

  // initiate chart drawing
  chart.draw();
});

function getData() {
  return [
    ['Janurai', <?php echo $jumlah1 = $data1[0]; ?>, <?php echo htmlentities($num0); ?>, <?php echo htmlentities($num2); ?>, <?php echo htmlentities($num3); ?>],
    ['Februari', <?php echo $jumlah2 = $data2[0]; ?>, <?php echo htmlentities($num4); ?>, <?php echo htmlentities($num5); ?>, <?php echo htmlentities($num6); ?>],
    ['Maret', <?php echo $jumlah3 = $data3[0]; ?>, <?php echo htmlentities($num7); ?>, <?php echo htmlentities($num8); ?>, <?php echo htmlentities($num9); ?>],
    ['April', <?php echo $jumlah4 = $data4[0]; ?>, <?php echo htmlentities($num10); ?>, <?php echo htmlentities($num11); ?>, <?php echo htmlentities($num12); ?>],
    ['Mei', <?php echo $jumlah5 = $data5[0]; ?>, <?php echo htmlentities($num13); ?>, <?php echo htmlentities($num14); ?>, <?php echo htmlentities($num15); ?>],
    ['Juni', <?php echo $jumlah6 = $data6[0]; ?>, <?php echo htmlentities($num16); ?>, <?php echo htmlentities($num17); ?>, <?php echo htmlentities($num18); ?>],
    ['Juli', <?php echo $jumlah7 = $data7[0]; ?>, <?php echo htmlentities($num19); ?>, <?php echo htmlentities($num20); ?>, <?php echo htmlentities($num21); ?>],
    ['Agustus', <?php echo $jumlah8 = $data8[0]; ?>, <?php echo htmlentities($num22); ?>, <?php echo htmlentities($num23); ?>, <?php echo htmlentities($num24); ?>],
    ['September', <?php echo $jumlah9 = $data9[0]; ?>, <?php echo htmlentities($num25); ?>, <?php echo htmlentities($num26); ?>, <?php echo htmlentities($num27); ?>],
    ['Oktober', <?php echo $jumlah10 = $data10[0]; ?>, <?php echo htmlentities($num28); ?>, <?php echo htmlentities($num29); ?>, <?php echo htmlentities($num30); ?>],
    ['November', <?php echo $jumlah11 = $data11[0]; ?>, <?php echo htmlentities($num31); ?>, <?php echo htmlentities($num32); ?>, <?php echo htmlentities($num33); ?>],
    ['Desember', <?php echo $jumlah12 = $data12[0]; ?>, <?php echo htmlentities($num34); ?>, <?php echo htmlentities($num33); ?>, <?php echo htmlentities($num36); ?>]
  ]
}
    </script> 

Kelima buat file dengan nama index.php, ini merupakan tahap terakhir untuk membuat AnyChart yang bagus dan menampilkan data database dengan kondisi tertentu. File ini index.php ini berfungsi sebagai form untuk menampilkan grafik AnyChart dan penggabungan source code dari semua source code di atas.

 <?php session_start();
include('config.php');
?>
<!DOCTYPE html>
<html>
<head>
 <title>AnyCharts</title>
 <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
 <script src="bootstrap/js/bootstrap.min.js"></script>
 
 <!--code install AnyCharts-->
 <script src="https://cdn.anychart.com/releases/v8/js/anychart-base.min.js"></script>
  <script src="https://cdn.anychart.com/releases/v8/js/anychart-ui.min.js"></script>
  <script src="https://cdn.anychart.com/releases/v8/js/anychart-exports.min.js"></script>
  <script src="https://cdn.anychart.com/releases/v8/js/anychart-stock.min.js"></script>
  <script src="https://cdn.anychart.com/releases/v8/js/anychart-data-adapter.min.js"></script>
  <link rel="stylesheet" href="https://cdn.anychart.com/releases/v8/css/anychart-ui.min.css" />
  <link rel="stylesheet" href="https://cdn.anychart.com/releases/v8/fonts/css/anychart-font.min.css" />
  <style>
  #container {
    width: 100%;
    height: 500px;
    margin: 0;
    padding: 0;
  }
</style>

<?php
    $status="";
    $tahun=date("Y");
    $total = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints where YEAR(regDate)='$tahun'");
    $data = mysqli_fetch_row($total);
    $totalall = $data[0];


    $hasil1 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='01' and YEAR(regDate)='$tahun'");
    $data1 = mysqli_fetch_row($hasil1);
    $jumlah1 = $data1[0];
    $percent1= $jumlah1 * $totalall /100 ;


    $hasil2 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='02' and YEAR(regDate)='$tahun'");
    $data2 = mysqli_fetch_row($hasil2);
    $jumlah2 = $data2[0];
    $percent2= $jumlah2 * $totalall /100 ;


    $hasil3 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='03' and YEAR(regDate)='$tahun'");
    $data3 = mysqli_fetch_row($hasil3);
    $jumlah3 = $data3[0];
    $percent3= $jumlah3 * $totalall /100 ;


    $hasil4 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='04' and YEAR(regDate)='$tahun'");
    $data4 = mysqli_fetch_row($hasil4);
    $jumlah4 = $data4[0];
    $percent4= $jumlah4 * $totalall /100 ;


    $hasil5 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='05' and YEAR(regDate)='$tahun'");
    $data5 = mysqli_fetch_row($hasil5);
    $jumlah5 = $data5[0];
    $percent5= $jumlah5 * $totalall /100 ;


    $hasil6 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='06' and YEAR(regDate)='$tahun'");
    $data6 = mysqli_fetch_row($hasil6);
    $jumlah6 = $data6[0];
    $percent6= $jumlah6 * $totalall /100 ;


    $hasil7 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='07' and YEAR(regDate)='$tahun'");
    $data7 = mysqli_fetch_row($hasil7);
    $jumlah7 = $data7[0];
    $percent7= $jumlah7 * $totalall /100 ;


    $hasil8 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='08' and YEAR(regDate)='$tahun'");
    $data8 = mysqli_fetch_row($hasil8);
    $jumlah8 = $data8[0];
    $percent8= $jumlah8 * $totalall /100 ;


    $hasil9 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='09' and YEAR(regDate)='$tahun'");
    $data9 = mysqli_fetch_row($hasil9);
    $jumlah9 = $data9[0];
    $percent9= $jumlah9 * $totalall /100 ;


    $hasil10 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='10' and YEAR(regDate)='$tahun'");
    $data10 = mysqli_fetch_row($hasil10);
    $jumlah10 = $data10[0];
    $percent10= $jumlah10 * $totalall /100 ;


    $hasil11 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='11' and YEAR(regDate)='$tahun'");
    $data11 = mysqli_fetch_row($hasil11);
    $jumlah11 = $data11[0];
    $percent11= $jumlah11 * $totalall /100 ;


    $hasil12 = mysqli_query($con,"SELECT count(*) as jum FROM tblcomplaints WHERE MONTH(regDate)='12' and YEAR(regDate)='$tahun'");
    $data12 = mysqli_fetch_row($hasil12);
    $jumlah12 = $data12[0];
    $percent12= $jumlah12 * $totalall /100 ;

    ?>



    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='01' and YEAR(regDate)='$tahun' and status is null");
    $num0 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='01' and YEAR(regDate)='$tahun' and status='$status'");
    $num2 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='01' and YEAR(regDate)='$tahun' and status='$status'");
    $num3 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End--> 


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='02' and YEAR(regDate)='$tahun' and status is null");
    $num4 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='02' and YEAR(regDate)='$tahun' and status='$status'");
    $num5 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='02' and YEAR(regDate)='$tahun' and status='$status'");
    $num6 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End--> 


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='03' and YEAR(regDate)='$tahun' and status is null");
    $num7 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='03' and YEAR(regDate)='$tahun' and status='$status'");
    $num8 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='03' and YEAR(regDate)='$tahun' and status='$status'");
    $num9 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='04' and YEAR(regDate)='$tahun' and status is null");
    $num10 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='04' and YEAR(regDate)='$tahun' and status='$status'");
    $num11 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='04' and YEAR(regDate)='$tahun' and status='$status'");
    $num12 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='05' and YEAR(regDate)='$tahun' and status is null");
    $num13 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='05' and YEAR(regDate)='$tahun' and status='$status'");
    $num14 = mysqli_num_rows($rt);
    {?>
    <?php } ?>



    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='05' and YEAR(regDate)='$tahun' and status='$status'");
    $num15 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->



    <!--Mulai-->
    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='06' and YEAR(regDate)='$tahun' and status is null");
    $num16 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='06' and YEAR(regDate)='$tahun' and status='$status'");
    $num17 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='06' and YEAR(regDate)='$tahun' and status='$status'");
    $num18 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='07' and YEAR(regDate)='$tahun' and status is null");
    $num19 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='07' and YEAR(regDate)='$tahun' and status='$status'");
    $num20 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='07' and YEAR(regDate)='$tahun' and status='$status'");
    $num21 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->



    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='08' and YEAR(regDate)='$tahun' and status is null");
    $num22 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='08' and YEAR(regDate)='$tahun' and status='$status'");
    $num23 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='08' and YEAR(regDate)='$tahun' and status='$status'");
    $num24 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->



    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='09' and YEAR(regDate)='$tahun' and status is null");
    $num25 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='09' and YEAR(regDate)='$tahun' and status='$status'");
    $num26 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='09' and YEAR(regDate)='$tahun' and status='$status'");
    $num27 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='10' and YEAR(regDate)='$tahun' and status is null");
    $num28 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='10' and YEAR(regDate)='$tahun' and status='$status'");
    $num29 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='10' and YEAR(regDate)='$tahun' and status='$status'");
    $num30 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='11' and YEAR(regDate)='$tahun' and status is null");
    $num31 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='11' and YEAR(regDate)='$tahun' and status='$status'");
    $num32 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='11' and YEAR(regDate)='$tahun' and status='$status'");
    $num33 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->


    <!--Mulai-->

    <?php
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='12' and YEAR(regDate)='$tahun' and status is null");
    $num34 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="in process"; 
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='12' and YEAR(regDate)='$tahun' and status='$status'");
    $num35 = mysqli_num_rows($rt);
    {?>
    <?php } ?>


    <?php
    $status="closed";                   
    $rt = mysqli_query($con,"SELECT * FROM tblcomplaints WHERE MONTH(regDate)='12' and YEAR(regDate)='$tahun' and status='$status'");
    $num36 = mysqli_num_rows($rt);
    {?>
    <?php } ?>

    <!--End-->

</head>
<body>
 <nav class="navbar navbar-default navbar-static-top">
  <div class="container-fluid">
   <div class="navbar-header">
    <a class="navbar-brand" href="https://www.tutorialswb.com/">TutorialsWB</a>
    <ul class="nav navbar-nav">
     <li class="active"><a href="index.html">Home</a></li>
    </ul>
   </div>
  </div>
 </nav>
 <div class="container">
  <div class="row">
      <div id="container"></div>

    </div>
  </div>
  <script type="text/javascript">
anychart.onDocumentReady(function() {
  // create data set on our data
  var dataSet = anychart.data.set(getData());

  // map data for the first series
  var seriesData_1 = dataSet.mapAs({
    'x': 0,
    'value': 1
  });

  // map data for the second series
  var seriesData_2 = dataSet.mapAs({
    'x': 0,
    'value': 2
  });

  // map data for the second series
  var seriesData_3 = dataSet.mapAs({
    'x': 0,
    'value': 3
  });

  // map data for the second series
  var seriesData_4 = dataSet.mapAs({
    'x': 0,
    'value': 4
  });

  // create line chart
  var chart = anychart.column();

  // turn on chart animation
  chart.animation(true);

  chart.padding(10);

  // disable Y axis
  chart.yAxis(false);

  // set X axis title
  chart.xAxis()
    .title('Month')
    .stroke('black', 2);

  chart.xAxis().ticks()
    .enabled(false);

  // force chart to stack values by Y scale
  chart.yScale().stackMode('value');

  // set chart title
  chart.title('Total Dan Status Komplaint Selama Setahun (2018)');


  // create data-area and set background settings
  chart.dataArea()
    .background()
    .enabled(true)
    .fill('#456')
    .corners(25, 25, 0, 0);

  // set grid settings
  chart.xGrid()
    .stroke('#fff .1')
    .isMinor(true)
    .drawFirstLine(false)
    .drawLastLine(false);

  chart.yGrid()
    .stroke('#fff .1')
    .isMinor(true)
    .drawFirstLine(false)
    .drawLastLine(false);



  // create first series with mapped data
  var series_1 = chart.column(seriesData_1);
  series_1.name('Total');

  // create second series with mapped data
  var series_2 = chart.column(seriesData_2);
  series_2.name('Not Process');

  // create second series with mapped data
  var series_3 = chart.column(seriesData_3);
  series_3.name('In Process');


  // create second series with mapped data
  var series_4 = chart.column(seriesData_4);
  series_4.name('Closed');

  // turn the legend on
  chart.legend()
    .enabled(true)
    .fontSize(13)
    .fontColor('white')
    .positionMode('inside')
    .margin({
      top: 15
    });

  // set container id for the chart
  chart.container('container');

  // initiate chart drawing
  chart.draw();
});

function getData() {
  return [
    ['Janurai', <?php echo $jumlah1 = $data1[0]; ?>, <?php echo htmlentities($num0); ?>, <?php echo htmlentities($num2); ?>, <?php echo htmlentities($num3); ?>],
    ['Februari', <?php echo $jumlah2 = $data2[0]; ?>, <?php echo htmlentities($num4); ?>, <?php echo htmlentities($num5); ?>, <?php echo htmlentities($num6); ?>],
    ['Maret', <?php echo $jumlah3 = $data3[0]; ?>, <?php echo htmlentities($num7); ?>, <?php echo htmlentities($num8); ?>, <?php echo htmlentities($num9); ?>],
    ['April', <?php echo $jumlah4 = $data4[0]; ?>, <?php echo htmlentities($num10); ?>, <?php echo htmlentities($num11); ?>, <?php echo htmlentities($num12); ?>],
    ['Mei', <?php echo $jumlah5 = $data5[0]; ?>, <?php echo htmlentities($num13); ?>, <?php echo htmlentities($num14); ?>, <?php echo htmlentities($num15); ?>],
    ['Juni', <?php echo $jumlah6 = $data6[0]; ?>, <?php echo htmlentities($num16); ?>, <?php echo htmlentities($num17); ?>, <?php echo htmlentities($num18); ?>],
    ['Juli', <?php echo $jumlah7 = $data7[0]; ?>, <?php echo htmlentities($num19); ?>, <?php echo htmlentities($num20); ?>, <?php echo htmlentities($num21); ?>],
    ['Agustus', <?php echo $jumlah8 = $data8[0]; ?>, <?php echo htmlentities($num22); ?>, <?php echo htmlentities($num23); ?>, <?php echo htmlentities($num24); ?>],
    ['September', <?php echo $jumlah9 = $data9[0]; ?>, <?php echo htmlentities($num25); ?>, <?php echo htmlentities($num26); ?>, <?php echo htmlentities($num27); ?>],
    ['Oktober', <?php echo $jumlah10 = $data10[0]; ?>, <?php echo htmlentities($num28); ?>, <?php echo htmlentities($num29); ?>, <?php echo htmlentities($num30); ?>],
    ['November', <?php echo $jumlah11 = $data11[0]; ?>, <?php echo htmlentities($num31); ?>, <?php echo htmlentities($num32); ?>, <?php echo htmlentities($num33); ?>],
    ['Desember', <?php echo $jumlah12 = $data12[0]; ?>, <?php echo htmlentities($num34); ?>, <?php echo htmlentities($num33); ?>, <?php echo htmlentities($num36); ?>]
  ]
}
    </script>
</body>
</html> 

Kalian bisa melihat hasil dari AnyChart ini pada gambar di atas, Kalian juga bisa langsung download filenya dengan menekan button download dibawah ini.


jangan lupa share dan tinggalkan komentar dibawah ini jika kalian ingin bertanya dan mempunyai kendala berrati dalam mengikuti tutorials diatas.


SUBSCRIBE TO OUR NEWSLETTER

close