|
setDataSymbol2 getting "Fatal error: Call to undefined function" |
Posted by Adam on Aug-30-2014 01:41 |
|
Hi I've tried several ways of trying to get an image instead of a star shape in one of my
scatter-plots, however I keep running into this error (or the shape defaults back to a red
square).
Currently the relevant parts of my Code is set up like this:
#Create a XYChart object
$c = new XYChart(900, 650, 0xFFFFFF );
#Set directory for loading images to current script directory
$c->setSearchPath(dirname(__FILE__));
#Add a chart layer
$tmpArrayMath1 = new ArrayMath($datay);
$tmpArrayMath1->selectEQZ($pointType, NoValue);
#OLD CODE
#$c->addScatterLayer($dataXXUT, $tmpArrayMath2->result(), "Selected Data",
# StarShape(5), 15, 0x6600ff);
#New Code
$c->addScatterLayer($datax, $tmpArrayMath1->result(), "Selected
Data").setDataSymbol2("image.png");
If I don't use setDataSymbol2 (and simply replace the "Starshape(5)" with "image.png") in
the old code I get the default red square. But the new code results in the error.
As you can see I've tried to setsearchPath to get to the correct directory, but it might
be part of the problem still... I'm simply at a loss as to how to fix the problem.
Any help would be greatly appreciated!
Adam |
Re: setDataSymbol2 getting "Fatal error: Call to undefined function" |
Posted by Peter Kwan on Aug-30-2014 02:04 |
|
Hi Adam,
The setDataSymbol2 is a method of the DataSet object, not the Layer object. You may
refer to the sample code "Custom Scatter Symbols" on how to use images as scatter
symbols:
http://www.advsofteng.com/doc/cdphp.htm#scattersymbols.htm
In brief, in PHP 5, the code should be like:
$scatterLayer = $c->addScatterLayer($datax, $tmpArrayMath1->result(), "Selected
Data");
$scatterLayer->getDataSet(0)->setDataSymbol2("image.png");
Hope this can help.
Regards
Peter Kwan |
Re: setDataSymbol2 getting "Fatal error: Call to undefined function" |
Posted by Adam on Aug-30-2014 02:11 |
|
Peter Kwan wrote:
Hi Adam,
The setDataSymbol2 is a method of the DataSet object, not the Layer object. You may
refer to the sample code "Custom Scatter Symbols" on how to use images as scatter
symbols:
http://www.advsofteng.com/doc/cdphp.htm#scattersymbols.htm
In brief, in PHP 5, the code should be like:
$scatterLayer = $c->addScatterLayer($datax, $tmpArrayMath1->result(), "Selected
Data");
$scatterLayer->getDataSet(0)->setDataSymbol2("image.png");
Hope this can help.
Regards
Peter Kwan
Thanks so much Peter, that did the trick! I should have realized it was a object reference problem.
Adam |
|