using Image_Graph_Fill in Image_Graph_Fill_ArrayDescription:
------------
Using Image_Graph-0.3.0dev2-pre:
There is a problem when using 'Image_Graph_Fill' in an 'Image_Graph_Fill_Array'. First of all, method &add(&$style, $id = '') in Image_Graph_Fill_Array should return $style, but has no return-value.
With this bug fixed, if you then use $style->setFillColor(), it will not be painted. If you use setBackgroundColor(), the plotarea ist painted with this color, not only the datapoint.
Reproduce code:
---------------
include_once('Image/Graph.php');
$graph =& Image_Graph::factory('graph', array(640, 400));
$graph->add($plotarea = Image_Graph::factory('plotarea'));
$dataset =& Image_Graph::factory('Dataset_Sequential', array(array('1' => 10, '2' => 20, '3' => 10)));
$plot =& $plotarea->addNew('bar', array($dataset, 'bar'));
$fill =& Image_Graph::factory('Image_Graph_Fill_Array');
$fill->addColor('#ff0000', '1');
$fill_green =& $fill->addNew('Image_Graph_Fill', null, '2');
// what is the right one to use ????
$fill_green->setFillColor('#00ff00');
$fill_green->setBackgroundColor('#00ff00');
$fill->addNew('Image_Graph_Fill_Gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, '#ff0000', '#ff0000'), '3');
$plot->setFillStyle(&$fill);
$graph->done();
Expected result:
----------------
Should paint three red bars.
oliver@... [2004-11-25 17:46:27]http://pear.php.net/bugs/2831
Image_Graph Bug
Reported by oliver@...
2004-11-25T17:46:27+00:00
PHP: 5.0.2 OS: Package Version:
Description:
------------
Using Image_Graph-0.3.0dev2-pre:
There is a problem when using 'Image_Graph_Fill' in an 'Image_Graph_Fill_Array'. First of all, method &add(&$style, $id = '') in Image_Graph_Fill_Array should return $style, but has no return-value.
With this bug fixed, if you then use $style->setFillColor(), it will not be painted. If you use setBackgroundColor(), the plotarea ist painted with this color, not only the datapoint.
Reproduce code:
---------------
include_once('Image/Graph.php');
$graph =& Image_Graph::factory('graph', array(640, 400));
$graph->add($plotarea = Image_Graph::factory('plotarea'));
$dataset =& Image_Graph::factory('Dataset_Sequential', array(array('1' => 10, '2' => 20, '3' => 10)));
$plot =& $plotarea->addNew('bar', array($dataset, 'bar'));
$fill =& Image_Graph::factory('Image_Graph_Fill_Array');
$fill->addColor('#ff0000', '1');
$fill_green =& $fill->addNew('Image_Graph_Fill', null, '2');
// what is the right one to use ????
$fill_green->setFillColor('#00ff00');
$fill_green->setBackgroundColor('#00ff00');
$fill->addNew('Image_Graph_Fill_Gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, '#ff0000', '#ff0000'), '3');
$plot->setFillStyle(&$fill);
$graph->done();
Expected result:
----------------
Should paint three red bars.]]>Image_Graph Bug
Reported by oliver@...
2004-11-25T17:46:27+00:00
PHP: 5.0.2 OS: Package Version:
Description:
------------
Using Image_Graph-0.3.0dev2-pre:
There is a problem when using 'Image_Graph_Fill' in an 'Image_Graph_Fill_Array'. First of all, method &add(&$style, $id = '') in Image_Graph_Fill_Array should return $style, but has no return-value.
With this bug fixed, if you then use $style->setFillColor(), it will not be painted. If you use setBackgroundColor(), the plotarea ist painted with this color, not only the datapoint.
Reproduce code:
---------------
include_once('Image/Graph.php');
$graph =& Image_Graph::factory('graph', array(640, 400));
$graph->add($plotarea = Image_Graph::factory('plotarea'));
$dataset =& Image_Graph::factory('Dataset_Sequential', array(array('1' => 10, '2' => 20, '3' => 10)));
$plot =& $plotarea->addNew('bar', array($dataset, 'bar'));
$fill =& Image_Graph::factory('Image_Graph_Fill_Array');
$fill->addColor('#ff0000', '1');
$fill_green =& $fill->addNew('Image_Graph_Fill', null, '2');
// what is the right one to use ????
$fill_green->setFillColor('#00ff00');
$fill_green->setBackgroundColor('#00ff00');
$fill->addNew('Image_Graph_Fill_Gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, '#ff0000', '#ff0000'), '3');
$plot->setFillStyle(&$fill);
$graph->done();
Expected result:
----------------
Should paint three red bars.]]>2004-11-25T17:46:27+00:00
@... [2004-11-26 02:32] http://pear.php.net/bugs/2831#1101436364
You shouldn't use either: Image_Graph_Fill is an abstract class :) (http://pear.php.net/package/Image_Graph/docs/0.3.0dev1/apidoc/Image_Graph-0.3.0dev1/Image_Graph_Fill.html)
However you do have a point, but it's more of a design issue! In previous versions the fill style was dependent upon coordinates and the 'easy' way to do this was to make the fillstyles inherited from Image_Graph_Element (but you could (rightly) argue that this is an apparent discrepancy with design - a fill is not really an element you put on the canvas). But this being history, because the fill's are now actually calculated by the driver when doing the actual fill (it has coordinates there of couse), this inheritance should be removed.
Solid colored fillings can only (and *should* only be done using addColor() - mainly due to performance).
But thanks a lot for your findings.
Also a little note in your usage of Image_Graph_Dataset_Sequential: the keys in your associated array are not used, it only uses the datavalues, i.e. 10, 20 and 10. But maybe it could be an idea to allow Image_Graph_Dataset_Trivial to get an array as parameter to the constructor with the associated data array instead of having to do ->addPoint(), ->addPoint()...]]>You shouldn't use either: Image_Graph_Fill is an abstract class :) (http://pear.php.net/package/Image_Graph/docs/0.3.0dev1/apidoc/Image_Graph-0.3.0dev1/Image_Graph_Fill.html)
However you do have a point, but it's more of a design issue! In previous versions the fill style was dependent upon coordinates and the 'easy' way to do this was to make the fillstyles inherited from Image_Graph_Element (but you could (rightly) argue that this is an apparent discrepancy with design - a fill is not really an element you put on the canvas). But this being history, because the fill's are now actually calculated by the driver when doing the actual fill (it has coordinates there of couse), this inheritance should be removed.
Solid colored fillings can only (and *should* only be done using addColor() - mainly due to performance).
But thanks a lot for your findings.
Also a little note in your usage of Image_Graph_Dataset_Sequential: the keys in your associated array are not used, it only uses the datavalues, i.e. 10, 20 and 10. But maybe it could be an idea to allow Image_Graph_Dataset_Trivial to get an array as parameter to the constructor with the associated data array instead of having to do ->addPoint(), ->addPoint()...]]>2004-11-26T02:32:44+00:00
@... [2004-11-25 17:55] http://pear.php.net/bugs/2831#1101405353
The example should return two red bars, and a green one. ;-)]]>The example should return two red bars, and a green one. ;-)]]>2004-11-25T17:55:53+00:00