estos datos los tomo de un .log que tiene el siguiente formato:
BANCO1=10
BANCO2=15
BANCO3=20,
Código
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script> </head> <?php // Leyendo una linea } // Cerrando el archivo //print_r($traer); $trxtotal1 = $trxtotal[0]; $trxtotal2 = $trxtotal[1]; //$newarr++; } // $dataPoints = array ($newarr[]); // //echo $y ."<br>"; // //echo $x ."<br>"; ?> <body> <div id="chartContainer"></div> <script type="text/javascript"> $(function () { var chart = new CanvasJS.Chart("chartContainer", { animationEnabled: true, title: { text: "Basic Column Chart using CanvasJS" }, data: [ { type: "column", } ] }); chart.render(); }); document.write(dataPoints); </script> </body> </html>
el array lo imprimo y me muestra esto:
Código:
Array ( [0] => Array ( [y] => 10 [label] => BANCO1 ) [1] => Array ( [y] => 15 [label] => BANCO2 ) [2] => Array ( [y] => 20 [label] => BANCO3 ) ).
gracias de ante mano.
· Los códigos deben ir en etiquetas GeSHi
· No se debe hacer doble post, el otro tema fue borrado
>aquí las reglas del foro
-Engel Lex