Postingan lainnya
Insert database to chart
Assalamualaikum, Kalau Boleh tau script saya salah di bagian mana?
Highcharts.chart('container5',
<?php
include 'koneksi_datin.php';
?>
<?php
$jumlahdws_datin = mysqli_query("select * from nossa where customer_segment='DWS'");
echo mysqli_num_rows($jumlahdws_datin);
?>
{
chart: {
backgroundColor: '#373e44'
},
title: {
text: '',
align: 'center',
verticalAlign: 'middle',
y: 40
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
dataLabels: {
enabled: true,
distance: -50,
style: {
fontWeight: 'bold',
color: 'white'
}
},
startAngle: 0,
endAngle: 360,
center: ['50%', '50%']
}
},
series: [{
colors: ['#54d9b6', '#16d1f6', '#f38ade', '#fef372', '#ffb853'],
type: 'pie',
name: 'Election',
size: '80%',
innerSize: '80%',
data:
[
{<?php echo ($jumlahdws_datin); ?>},
{name: "", y: 10},
{name: "", y: 15},
{name: "", y: 15},
{name: "", y: 25}
]
}, {
colors: ['#54d9b6', '#16d1f6', '#f38ade', '#fef372', '#ffb853'],
type: 'pie',
name: 'Proprietary or Undetectable',
innerSize: '90%',
data:
[{name: "", y: 10},
{name: "", y: 15},
{name: "", y: 20},
{name: "", y: 15},
{name: "", y: 25}
]
}]
});
Tanggapan
emang errornya apa gan?
errornya di chart ga muncul datanya gan
data ini yg ga muncul <?php echo ($jumlahdws_datin); ?>?
benar banget gan
solusinya gimana ya gan?
3 Jawaban:
Jawaban Terpilih
coba ini <pre> //taruh kode dibawah ini setelah echo mysqli_num_rows($jumlahdws_datin); $jmlfix = mysqli_num_rows($jumlahdws_datin); //<?php echo ($jumlahdws_datin); ?> ini ganti dengan <?php echo ($jmlfix); ?> </pre>
Tanggapan
masih tetap eror gan
error atau solved?
ga ada ngaruh gan tetap sperti awalnya charnya ga muncul, koneksi ke database sy jga udah benar
kalo hanya munculkan jumlah data sudah benar pake code ane diatas, coba ini benerin juga <pre> $jumlahdws_datin = mysqli_query($konek, "select * from nossa where customer_segment='DWS'"); </pre> variable $konek sesuaikan
Tanggapan
tetap ga ada perubahan gan :(
<pre> Highcharts.chart('container5', <?php include 'koneksi_datin.php'; ?> <?php $jumlahdws_datin = mysqli_query($koneksi_datin, "select * from nossa where customer_segment='DWS'"); echo mysqli_num_rows($jumlahdws_datin); $jmlfix = mysqli_num_rows($jumlahdws_datin); ?> { chart: { backgroundColor: '#373e44' }, title: { text: '', align: 'center', verticalAlign: 'middle', y: 40 }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotOptions: { pie: { dataLabels: { enabled: true, distance: -50, style: { fontWeight: 'bold', color: 'white' } }, startAngle: 0, endAngle: 360, center: ['50%', '50%'] } }, series: [{ colors: ['#54d9b6', '#16d1f6', '#f38ade', '#fef372', '#ffb853'], type: 'pie', name: 'Election', size: '80%', innerSize: '80%', data: [ {<?php echo ($jmlfix); ?>}, {name: "", y: 10}, {name: "", y: 15}, {name: "", y: 15}, {name: "", y: 25}
]
}, {
colors: ['#54d9b6', '#16d1f6', '#f38ade', '#fef372', '#ffb853'],
type: 'pie',
name: 'Proprietary or Undetectable',
innerSize: '90%',
data:
[{name: "", y: 10},
{name: "", y: 15},
{name: "", y: 20},
{name: "", y: 15},
{name: "", y: 25}
]
}]
});
</pre>