extending/using Image_Graph
| From: | dave | Date: | Fri, 16 Jun 2006 11:12:41 +0000 |
| Subject: | extending/using Image_Graph | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-24397@lists.php.net to get a copy of this message | ||
hi all
i'm working on a project that needs to set specific labels on the y-axis to bold, and have icons next to them
currently, image_graph does not provide the ability to do this for specific labels (i believe the guy is working on it, but who knows when that could be done)
the issue i am having is that the whole y axis (just the labels) is drawn by a private method deep down inside a private _done method
where each _done method calls it's parent::_done() method again
the class is called like
| |
| $this->graph = Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$font = $this->graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$font->setSize(8);
$this->graph->setFont($font);
$plotArea = new SamplePlotArea('Image_Graph_Axis_Category',
'Image_Graph_Axis',
'horizontal'); |
these are the classes that are called when that SamplePlotArea calls it's constructor using
| |
| function SamplePlotArea($axisX, $axisY, $var) {
//something like this
$this->axisX = Image_Graph::factory($axisX, $var);
} |
Image_Graph_Axis extends Image_Graph_PlotArea_Element
Image_Graph_PlotArea_Element extends Image_Graph_Element
Image_Graph_Element extends Image_Graph_Common
----------------------------------------------------
each having their own _done() method that calls the parent::done() method up till the Image_Graph_Common class, which just calls the child _done() method
and basically inside the Image_Graph_Axis class there is a method called _drawTick() which draws the labels for the y axis, and this is called from the Image_Graph_Axis' _done method
So how can I rewrite the method or write a class that is used instead for that method only?
the thing that has me puzzled is how to write something that will allow me to use that _drawTick method for everything else, but still allow me to use the customised version where needed without having to re-write a lot of the pear classes
any suggestions
dave
--
http://dtracorp.com