how to graph data from a survey in php and also get the percentage

0
<div class="col-md-6">
 <?php
 include('conexion.php');

$con=mysqli_query($mysqli,"SELECT u.id_subcategoria,u.id_categoria,d.id_pregunta,d.nombre,r.resultado FROM sub_categorias u,preguntas d,resultados r WHERE d.id_subcategoria = u.id_subcategoria and d.id_pregunta=r.id_pregunta and u.id_categoria=1 and r.resultado=2");


?>
<div id="container" style="width: 600px; height: 400px;"></div> 

 <script type="text/javascript">
Highcharts.chart('container', {
    chart: {
        type: 'pie',
        options3d: {
            enabled: true,
            alpha: 45,
            beta: 0
        }
    },
    title: {
        text: 'resultados de Cultura'
    },
    tooltip: {
        pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
    },
        plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            depth: 35,
            dataLabels: {
                enabled: true,
                format: '{}'
            }
        }
    },
    series: [{
        type: 'pie',
        name: 'resultados de Cultura',
        data: [

  <?php 
 while ($row =mysqli_fetch_array($con)){
 echo " ['".$row[""]."...de acuerdo',".$row["resultado"]."],";

          }

        ?>
 ]
    }]
});
</script>  
    
asked by juan 16.11.2018 в 20:23
source

0 answers