pChart 2.x forum
http://wiki.pchart.net/forum/

Class Constants?
http://wiki.pchart.net/forum/viewtopic.php?f=3&t=2306
Page 1 of 1

Author:  rocketsci [ Sat Dec 17, 2011 12:10 am ]
Post subject:  Class Constants?

I'm new to using pChart (and PHP), so perhaps there is a sound reason for the following:

I would like to wrap much of the class instances / graph creation method calls in a predefined function, but I obviously need to call that function and pass it arguments to help define the resulting graph.
e.g.:

Code:
function graphMulti(array $DataArray = NULL, $PlotMultiX = TRUE, $PlotMultiY = FALSE, $FormatX=pData::AXIS_FORMAT_TIME)


As you can see, I was planning on calling the AXIS_FORMAT_TIME class constant, only to find that it isn't defined as a class constant:

pData class definition:
Code:
/* Axis configuration */
define("AXIS_FORMAT_DEFAULT"      , 680001);
define("AXIS_FORMAT_TIME"      , 680002);
define("AXIS_FORMAT_DATE"      , 680003);
define("AXIS_FORMAT_METRIC"      , 680004);
define("AXIS_FORMAT_CURRENCY"      , 680005);
define("AXIS_FORMAT_CUSTOM"      , 680006);


Is there a particular reason why the above constant definitions in the pData class are not defined as:
Code:
/* Axis configuration */
const AXIS_FORMAT_DEFAULT = 680001;
const AXIS_FORMAT_TIME = 680002;
const AXIS_FORMAT_DATE = 680003;
const AXIS_FORMAT_METRIC = 680004;
const AXIS_FORMAT_CURRENCY = 680005;
const AXIS_FORMAT_CUSTOM = 680006;



Thanks!

-Joe

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/