borgplasma
New pChart user
Joined: Mon Aug 19, 2013 7:01 pm Posts: 1
|
Barchart with Data from MySQL
Hello Folks, i am new with pchart, it is a great thing to realize own Charts. So now, i have a question regarding to get Data from MySQL.
I want to do a Bar Graph, where i want to show Values Monthly over Years.
This means, the Serie ist the Year, the Absissa is the Month. Something like the Sandbox-Example of the BarGraph.
My Problem is now, that the Data in my MySQL-DB is like this:
Year Month Value 2012 01 312.5 2012 02 229 2012 03 243 2012 04 193 2012 05 202 2012 06 184 2012 07 166 2012 08 209 2012 09 207 2012 10 256 2012 11 234 2012 12 223
But the Sandboxexample of the BarGraph shows me the Data should be like this: (One Serie is like One Year, each Value of them is a month)
$myData = new pData(); $myData->addPoints(array(19,-37,50,-30,-44,-19,28,33),"Serie1"); $myData->setSerieDescription("Serie1","Serie 1"); $myData->setSerieOnAxis("Serie1",0);
$myData->addPoints(array(17,-29,36,-7,21,-7,-11,46),"Serie2"); $myData->setSerieDescription("Serie2","Serie 2"); $myData->setSerieOnAxis("Serie2",0);
$myData->addPoints(array(24,-27,-24,12,14,39,30,-11),"Serie3"); $myData->setSerieDescription("Serie3","Serie 3"); $myData->setSerieOnAxis("Serie3",0);
$myData->addPoints(array("January","February","March","April","May","June","July","August"),"Absissa"); $myData->setAbscissa("Absissa");
So my question is, how can i read out my Data from MySQL in the right Format for the Bargraph like the Example shows me?
Thank you for your help, if you need more Information please ask. And sorry for my bad English.
with Regards, Oliver from Germany
|