Mi mesa (tb_ticket) a la que le gusta esto:
| técnico_1 | Técnico_2 |
|---|---|
| ema | ema |
| Tomás | ema |
| Lisa | Tomás |
| Ana | Lisa |
| Tomás | Tomás |
Mi pregunta es cómo hacerlo así:
Ema=3, Tom=4, Ana=1, Lisa=2
mi consulta
<script> var ctx = document.getElementById("myChart").getContext('2d'); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Ema", "Tom", "Ana", "Lisa"], datasets: [{ label: 'Request by technician', data: [ <?php $technician_ema= mysqli_query($koneksi,"select * from tb_ticket where (technician_1','technician_2)='Ema'"); echo mysqli_num_rows($technician_ema); ?>, <?php $technician_tom= mysqli_query($koneksi,"select * from tb_ticket where (technician_1','technician_2)='Tom'"); echo mysqli_num_rows($technician_tom); ?>, <?php $technician_ana= mysqli_query($koneksi,"select * from tb_ticket where (technician_1','technician_2)='Ana'"); echo mysqli_num_rows($technician_ana); ?>, <?php $technician_lisa= mysqli_query($koneksi,"select * from tb_ticket where (technician_1','technician_2)='Lisa'"); echo mysqli_num_rows($technician_lisa); ?> ], backgroundColor: [ '#1B4F72', '#21618C', '#2874A6', '#2E86C1' ], }] }, options: { scales: { xAxes: [{ ticks: { autoSkip: false } }] } } }); </script>Combine el número total de técnicos de la columna técnico_1 y técnicos_2 en un gráfico de barras.
Resuelto. cambiar el código de abajo.
<?php $technician_lisa= mysqli_query($koneksi,"select * from tb_ticket where technician_1='lisa' or technician_2='Lisa'"); echo mysqli_num_rows($technician_lisa); ?>