I am using the pChart (http://www.pchart.net/) PHP class framework to create a pie chart using database values which I have extracted using this select query:
$query = "SELECT Labels, COUNT(quantity) as quantity FROM inventory GROUP BY Labels";
$result = $mysqli->query($query);
/* associative array */
while($row = $result->fetch_assoc())
{
$titles = (array_values($row));
$count = $row['quantity'];
$Labels = $row['Labels'];
print_r($count);
print_r($Labels);
}
The implementation procedure for the pChart framework requires two array data sources as shown in code sample below:
The absissa series, and ordinate series
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(40,60,15,10,6,4,80),"quantity");
$MyData->setSerieDescription("quantity","Application A");
/* Define the absissa series */
$MyData->addPoints(array("Table","Chair","Bed","Stove","Lamp","Rug", "Others"),"Labels");
$MyData->setAbscissa("Labels");
Within this context, how may I get the absissa and ordinate values as arrays into the pChart for creations of the pie chart?
Thanks