How to show a empty google pie chart when there no data?


google.charts.load('current', {packages: ["corechart","calendar","table"]}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Nama Barang'); data.addColumn('number', 'Jumlah Transaksi'); data.addRows ([ <?php $coba = ""; $petik = "'"; foreach ($dataPie_k as $row) { $coba = $coba."['$row->nama', $row->total],"; } echo substr($coba,0,strlen($coba)-1); ?> ]); var options = { title: 'Rating 5', is3D: true, legend: 'none', pieSliceText: 'label', }; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options); }


Is it possible to display a chart if there is no data? Any help would be much appreciated. please help me.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!