For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2006 > Re: [PEAR] extending/using Image_Graph









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] extending/using Image_Graph
Justin Patrin

2006-06-17, 7:00 pm

On 6/16/06, dave <dave@dtracorp.com> wrote:
> 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_Categor
y',
> 'Image_Graph_Axis',
> 'horizontal');
> |


Well, you specify the acis class above. Just create your own extended
class and use that.

class Image_Graph_Axis_SomeBold extends Image_Graph_Axis {
function _drawTick(...) {
if (some condition) {
set font bold
} else {
set font not bold
}
parent::_drawTick(...);
}
}

$plotArea = new SamplePlotArea('Image_Graph_Axis_Categor
y',
'Image_Graph_Axis_SomeBold',
'horizontal');

--
Justin Patrin
dave

2006-06-17, 10:00 pm

Justin Patrin wrote:
> On 6/16/06, dave <dave@dtracorp.com> wrote:
>
> Well, you specify the acis class above. Just create your own extended
> class and use that.
>
> class Image_Graph_Axis_SomeBold extends Image_Graph_Axis {
> function _drawTick(...) {
> if (some condition) {
> set font bold
> } else {
> set font not bold
> }
> parent::_drawTick(...);
> }
> }
>
> $plotArea = new SamplePlotArea('Image_Graph_Axis_Categor
y',
> 'Image_Graph_Axis_SomeBold',
> 'horizontal');
>

hmmm.. interesting, thanks, i'll have a look at that, and see what i can do

--
http://dtracorp.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com