![Post Post](./styles/avalon/imageset/icon_topic_latest.gif)
scaleFormat() method doesn't handle class-method callbacks
I'm using AXIS_FORMAT_CUSTOM to generate y-axis labels, and want to use a class' method, rather than an isolated function. Currently, this doesn't work.
I've isolated the problem to pDraw::scaleFormat(), which performs a function_exists check on the callback function provided before executing it using call_user_func (see line 3134). I've managed to get by this by extending pImage and overriding scaleFormat, but this should be updated in the core, in my humble opinion
![Smile :)](./images/smilies/icon_e_smile.gif)
The following would provide an adequate check for class methods:
Code:
if ( $Mode == AXIS_FORMAT_CUSTOM ) {
if ( function_exists($Format) || is_array($Format) && method_exists($Format[0], $Format[1]) ) {
return( call_user_func($Format,$Value) );
}
}
Cheers,
Eric