View unanswered posts | View active topics It is currently Sat Feb 24, 2024 4:28 pm



Reply to topic  [ 1 post ] 
scaleFormat() method doesn't handle class-method callbacks 
Author Message
New pChart user
New pChart user

Joined: Thu May 10, 2012 10:25 pm
Posts: 3
Location: Melbourne, Australia
Post 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 :)

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

_________________
jQuery newsticker -- jNewsticker is a powerful news ticker with professionally designed skins, multiple animation styles and instant item loading from Twitter, Facebook, Pinterest, Last.fm, Tumblr and any RSS feed.


Thu May 17, 2012 2:36 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron