From e87cdd6893df41826e848beb9a25ae6194cc10e7 Mon Sep 17 00:00:00 2001 From: humano Date: Sun, 29 Oct 2017 19:46:36 -0500 Subject: [PATCH] mejoras en la graficacion de estadisticas --- milfs/funciones/funciones.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/milfs/funciones/funciones.php b/milfs/funciones/funciones.php index cf6d742..442109f 100644 --- a/milfs/funciones/funciones.php +++ b/milfs/funciones/funciones.php @@ -587,7 +587,7 @@ if($mostrar[0] !="") { return $contenido; } -$consulta = "SELECT count(control) as cantidad , id_campo ,contenido FROM `form_datos`, `form_campos` WHERE `form_datos`.id_campo = `form_campos`.id AND `id_campo` = '$id_campo' AND `form_id` = '$id_form' GROUP BY $group order by cantidad"; +$consulta = "SELECT count(control) as cantidad , id_campo ,contenido , campo_nombre FROM `form_datos`, `form_campos` WHERE `form_datos`.id_campo = `form_campos`.id AND `id_campo` = '$id_campo' AND `form_id` = '$id_form' GROUP BY $group order by cantidad"; $link=Conectarse(); mysqli_set_charset($link, "utf8"); $sql=mysqli_query($link,$consulta); @@ -599,7 +599,7 @@ mysqli_set_charset($link, "utf8"); $lineas .="$row[cantidad]$row[contenido]"; $datas .="'$row[cantidad]',"; - $etiquetas .="'$row[contenido]',"; + $etiquetas .="'".html_entity_decode($row['contenido'])." $row[campo_nombre] ($row[cantidad]) ',"; $colores .= "'#".substr(md5(rand()), 0, 6)."',"; } $datos= json_encode($dato); @@ -611,7 +611,7 @@ $data_grafica= " datasets: [{ data: $data , backgroundColor: $color, - label: 'Cantidad ' + label: '' }], labels: $etiqueta @@ -645,7 +645,15 @@ $data_grafica }, options: { responsive: true, scales: { xAxes: [{display: false}]}, - legend: { display: false } + legend: { display: false }, + tooltips: { + callbacks: { + label: function(tooltipItem, data) { + + var label = data.labels[tooltipItem.index].label; + return label; + }}} + } };