#013361: 3d pie chart with incorrect color rendered on top of chart

Description:

require_once 'ezc/Base/ezc_bootstrap.php';
spl_autoload_register( array( 'ezcBase', 'autoload' ) );

function nolabel_number_pct($label, $num, $pct) {
    return number_format($num).' ('.number_format(100.0*$pct,2).'%)';
}

class myPalette extends ezcGraphPalette {
    protected $axisColor = '#2E3436';
    protected $dataSetColor = 
        array('#317023', '#FFFF00', '#FF0000' );
    protected $dataSetSymbol = array(
        ezcGraph::NO_SYMBOL,
    );
    protected $fontName = 'arial';
    protected $fontColor = '#2E3436';
    protected $chartBackground = '#FFFFFF';
    protected $padding = 1;
    protected $margin = 0;
}

$graphdata = array('green' => 5519656.29, 'yellow' => 13250988.91, 'red' => 1607.98);
$title = 'top should be green and yellow not red';
$width=400;

$chart = new ezcGraphPieChart();        
$chart->driver = new ezcGraphGdDriver();
$chart->palette = new myPalette; 
$chart->legend->position = ezcGraph::BOTTOM; 
$chart->options->font = '/usr/share/php5/jpgraph_fonts/verdana.ttf';
$padding = str_repeat(' ',10);
$chart->title = $padding.$title.$padding;
$chart->data['dataset'] = new ezcGraphArrayDataSet($graphdata);
$chart->options->labelCallback = 'nolabel_number_pct';

$chart->renderer = new ezcGraphRenderer3d();

$chart->renderer->options->pieChartGleam = .3;
$chart->renderer->options->pieChartGleamColor = '#FFFFFF';
$chart->renderer->options->pieChartGleamBorder = 2;
$chart->renderer->options->pieChartShadowSize = 3;
$chart->renderer->options->pieChartShadowColor = '#000000'; 
$chart->renderToOutput($width,$width);

Environment:

Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):


Steps to Reproduce:

gentoo linux
php 5.1.6
db n/a
any (used FF3)


- Attachments
ezCGraphPieBug.png (94 kb)
[Download] [Permanent Link]
rendered output of script

- Comments

Sorry, realized I actually tested on a different system which was PHP 5.2.6

#257466 by Jason Sweat on July 16th, 2008 [Permanent Link]

This is actually a bug in PHPs ext/gd, like you can see here: http://bugs.php.net/45552url

I will add a workaround in the graph component soon. Until then you might want to try the superior cairo renderer, like documented here: http://ezcomponents.org/docs/tutorials/Graph#cairo-driverurl

#257500 by Kore Nordmann on July 18th, 2008 [Permanent Link]

Workaround for PHP bug added in revision #8608. This workarround will be part of the next release.

#257501 by Kore Nordmann on July 18th, 2008 [Permanent Link]

- History
Properties
Type Bug
Priority Medium
Component Components » Graph
Affects Unknown
Fix Version -
Reporter Jason Sweat
Responsible Kore Nordmann
Status 0 Closed
Resolution Fixed
Created July 16th, 2008
Updated July 18th, 2008
Resolved July 18th, 2008
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels