1

I am just editing the Naked example of pChart, I have setup all of my MySQL information to retrive the AddPoints from the database.

This uses something like the below.

$DataSet->AddPoint(array(1,2,3,4,5,6,7,8,9));

When I attempt to do

$var = '1,2,3,4,5,6,7,8,9';
$DataSet->AddPoint($var);

It doesn't work, but when I do

$var = array('1,2,3,4,5,6,7,8,9');
$DataSet->AddPoint($var);

it does work.

I have also tried:

$var2 = "1,2,3,4,5,6,90";
$var = array("$var2");
$DataSet = new pData;
$DataSet->AddPoint($var);

Any suggestions?

safarov
  • 7,793
  • 2
  • 36
  • 52
user1307300
  • 17
  • 1
  • 2
  • 4

1 Answers1

0

Simple you must provide array to this method:

$DataSet->AddPoint()

I am not sure why you are not giving array but if you want to give a string seperated by comma. You could do this way:

 $DataSet->AddPoint(explode(',', '1,2,3,4,5,6,90'));
Aurimas Ličkus
  • 9,886
  • 4
  • 24
  • 26
  • I'm gathering the data from a MySQL database, so I plan to put it in a loop and make it get the information from $var = $rowname and then replace the $var in the addpoints with the $var, I have read the pChart MySQL documentation but it doesn't suit what I need. – user1307300 Apr 02 '12 at 11:19