Google charts: error All series on a given axis must be of the same data type

0

I have the following code that is carried by ajax to the google chart function.

    $exgetChartDelitos =$conexion->Query("SELECT delito, COUNT(*)repes from geo_nsn group by delito having count(*)>1");
    $numeroFilas = mysql_num_rows($exgetChartDelitos);
    $datos[0] = array('Delito','Cantidad');



    for ($i=1; $i<($numeroFilas+1); $i++)
{
    $datos[$i] = array(mysql_result($exgetChartDelitos, $i-1, "delito"),
    (int) mysql_result($exgetChartDelitos, $i-1, "repes"));
}

   echo (json_encode($datos));

However, when I want to color the bars (in this case silver, but later I want it to be random) it does not work for me and I get the error: Error: All series on a given axis must be of the same data type

 $exgetChartDelitos =$conexion->Query("SELECT delito, COUNT(*)repes from geo_nsn group by delito having count(*)>1");
    $numeroFilas = mysql_num_rows($exgetChartDelitos);
    $datos[0] = array('Delito','Cantidad', '{ role: "style" }');



    for ($i=1; $i<($numeroFilas+1); $i++)
{
    $datos[$i] = array(mysql_result($exgetChartDelitos, $i-1, "delito"),
    (int) mysql_result($exgetChartDelitos, $i-1, "repes"), "silver" );
}

   echo (json_encode($datos));
    
asked by Andress Blend 11.01.2017 в 17:12
source

1 answer

1

Solution:

$datos[0] = array('Delito','Cantidad',array('role' => "style"));

ref = link

    
answered by 12.01.2017 в 14:16