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)
|
|