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}


            ]
        }]
    });

avatar Mantofani
@Mantofani

60 Kontribusi 3 Poin

Diperbarui 5 tahun yang lalu

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); //&lt;?php echo ($jumlahdws_datin); ?&gt; ini ganti dengan &lt;?php echo ($jmlfix); ?&gt; </pre>

avatar dianarifr
@dianarifr

642 Kontribusi 316 Poin

Dipost 5 tahun yang lalu

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

avatar dianarifr
@dianarifr

642 Kontribusi 316 Poin

Dipost 5 tahun yang lalu

Tanggapan

tetap ga ada perubahan gan :(

<pre> Highcharts.chart('container5', &lt;?php include 'koneksi_datin.php'; ?&gt; &lt;?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); ?&gt; { chart: { backgroundColor: '#373e44' }, title: { text: '', align: 'center', verticalAlign: 'middle', y: 40 }, tooltip: { pointFormat: '{series.name}: &lt;b&gt;{point.percentage:.1f}%&lt;/b&gt;' }, 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: [ {&lt;?php echo ($jmlfix); ?&gt;}, {name: "", y: 10}, {name: "", y: 15}, {name: "", y: 15}, {name: "", y: 25}

        ]
    }, {
        colors: [&#039;#54d9b6&#039;, &#039;#16d1f6&#039;, &#039;#f38ade&#039;, &#039;#fef372&#039;, &#039;#ffb853&#039;],
        type: &#039;pie&#039;,
        name: &#039;Proprietary or Undetectable&#039;,
        innerSize: &#039;90%&#039;,
        data: 
        [{name: &quot;&quot;, y: 10},
        {name: &quot;&quot;, y: 15},
        {name: &quot;&quot;, y: 20},
        {name: &quot;&quot;, y: 15},
        {name: &quot;&quot;, y: 25}
           
            
        ]
    }]
});

</pre>

avatar Mantofani
@Mantofani

60 Kontribusi 3 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban