php - PHPGraphlib Too Many Datapoints -



php - PHPGraphlib Too Many Datapoints -

i'm trying create chart of of our tickets our helpdesk software based on month/year came in. have ran query against database , getting i'm looking for.

i've found phpgraphlib generate charts based on array entered. i'm getting constant errors graph either little or many datapoints.

error:

i know it's generating array correctly because able view contents via:

print_r($data);

output of print_r($data);

array ( [march 2012] => 10 [april 2012] => 18 [may 2012] => 20 [june 2012] => 19 [july 2012] => 10 [august 2012] => 22 [september 2012] => 18 [october 2012] => 17 [november 2012] => 15 [december 2012] => 12 [january 2013] => 24 [february 2013] => 18 [march 2013] => 33 [april 2013] => 13 [may 2013] => 20 [june 2013] => 20 [july 2013] => 21 [august 2013] => 13 [september 2013] => 15 [october 2013] => 14 [november 2013] => 14 [december 2013] => 3 [january 2014] => 13 [february 2014] => 15 [march 2014] => 23 [april 2014] => 20 [may 2014] => 33 [june 2014] => 19 )

.

<?php include("../phpgraphlib.php"); $graph = new phpgraphlib(1000,1000); include 'db.inc'; $sql="select from_unixtime(swtickets.dateline,'%m %y') month, count(distinct(ticketmaskid)) count swtickets grouping from_unixtime(swtickets.dateline,'%m %y') order from_unixtime(swtickets.dateline,'%y'), from_unixtime(swtickets.dateline,'%m') asc"; $result=mysql_query($sql); $data = array(); $num=mysql_numrows($result); $i=0; while ($i < $num){ $mon=mysql_result($result,$i,"month"); $co=mysql_result($result,$i,"count"); $data[$mon]=$co; $i++; } mysql_close(); $graph->adddata($data); $graph->setbarcolor('255,255,204'); $graph->settitle('money made @ xyz corp'); $graph->settextcolor('gray'); $graph->creategraph(); ?>

i've tried limiting query include 1 datapoint , still generates same error.

if create array manually doesn't generate error , generates graph expected.

<?php include("../phpgraphlib.php"); $graph = new phpgraphlib(5000,5000); $data = array( "march 2012" => "10", "april 2012" => "18", "may 2012" => "20", "june 2012" => "19", "july 2012" => "10", "august 2012" => "22", "september 2012" => "18", "october 2012" => "17", "november 2012" => "15", "december 2012" => "12", "january 2013" => "24", "february 2013" => "18", "march 2013" => "33", "april 2013" => "13", "may 2013" => "20", "june 2013" => "20", "july 2013" => "21", "august 2013" => "13", "september 2013" => "15", "october 2013" => "14", "november 2013" => "14", "december 2013" => "3", "january 2014" => "13", "february 2014" => "15", "march 2014" => "23", "april 2014" => "20", "may 2014" => "33", "june 2014" => "19", ); $graph->adddata($data); $graph->setbarcolor('255,255,204'); $graph->settitle('money made @ xyz corp'); $graph->settextcolor('gray'); $graph->creategraph(); ?>

output page: i've tried on standard php page , html page receive same result.

<!doctype html> <html> <head> <title></title> </head> <body> <img src="graphs/alltickets.php" /> </body> </html>

any ideas? recommend other free graphing libraries php?

thanks mr. llama , vikingblooded found problem. looking through logs found couldn't reference db.inc file. when testing array before had on file in different directory. in graphs/alltickets.php referencing file in directory above without ../

so had alter

include '../db.inc';

such stupid mistake. everyone.

php phpgraphlib

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -