Enviado em 14/06/2013 - 09:51h
Bom dia!
Estou tentando exibir dados de uma tabela do mysql em grafico com phplot, mas não estou conseguindo!
alguem pode me ajudar??
<?php
include("conexao.php");
include("phplot/phplot.php");
$plot = new PHPlot();
//Set plot and data type
$plot -> SetPlotType ( 'lines' );
$plot -> SetDataType ( 'text-data' );
//Select testdb and assign data to variable $data
$r = mysql_query("SELECT id, nome FROM clientes WHERE id>=20");
if (! $r ) exit();
$data = array();
$n_rows = mysql_num_rows ( $r );
for ( $i = 0 ; $i < $n_rows ; $i ++) $data [] = mysql_fetch_row ( $r );
$plot -> SetDataValues ( $data );
$plot -> SetXDataLabelPos ( 'none' );
$plot -> SetLineWidths ( 3 );
$plot -> SetDrawXGrid ( True );
//Draw the graph
$plot -> DrawGraph ();
?>
Estou tentando exibir dados de uma tabela do mysql em grafico com phplot, mas não estou conseguindo!
alguem pode me ajudar??
<?php
include("conexao.php");
include("phplot/phplot.php");
$plot = new PHPlot();
//Set plot and data type
$plot -> SetPlotType ( 'lines' );
$plot -> SetDataType ( 'text-data' );
//Select testdb and assign data to variable $data
$r = mysql_query("SELECT id, nome FROM clientes WHERE id>=20");
if (! $r ) exit();
$data = array();
$n_rows = mysql_num_rows ( $r );
for ( $i = 0 ; $i < $n_rows ; $i ++) $data [] = mysql_fetch_row ( $r );
$plot -> SetDataValues ( $data );
$plot -> SetXDataLabelPos ( 'none' );
$plot -> SetLineWidths ( 3 );
$plot -> SetDrawXGrid ( True );
//Draw the graph
$plot -> DrawGraph ();
?>