extranet/www/graphs/bilan_graph_sig.php

57 lines
1.8 KiB
PHP
Raw Normal View History

2009-03-30 16:27:40 +00:00
<?php
2009-03-30 16:41:42 +00:00
require_once './lib/phpchartdir.php';
2009-03-30 16:27:40 +00:00
# The data for the pie chart
$data = unserialize(urldecode($_REQUEST['d']));
$firephp->log($data,'data');
$w = 570;
$h = 210;
$x = round($w/2);
$y = round($h/2);
$radius=70;
$c = new PieChart($w, $h);
# The labels for the pie chart
2009-03-31 15:42:42 +00:00
$labels = array('Achats de marchandises.',
2009-03-30 16:27:40 +00:00
'Autres achats externes',
'Charges de fonctionnement',
'Amortissement et provisions',
'Perte financi<63>re',
'Imp<6D>ts soci<63>t<EFBFBD>s',
'R<>SULTAT NET',
);
$textBoxObj = $c->addTitle("Solde Interm<72>diaire de Gestion", "timesbi.ttf", 15);
# Set the center of the pie at (180, 140) and the radius to 100 pixels
$c->setPieSize($x, $y, $radius);
$c->setLabelLayout(SideLayout);
# Set the label box background color the same as the sector color, with glass effect,
# and with 5 pixels rounded corners
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
# Set the border color of the sector the same color as the fill color. Set the line # color of the join line to black (0x0)
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=arial.ttf,size=0*>({percent|0}%)");
# Set the start angle to 135 degrees may improve layout when there are many small
# sectors at the end of the data array (that is, data sorted in descending order). It
# is because this makes the small sectors position near the horizontal axis, where
# the text label has the least tendency to overlap. For data sorted in ascending
# order, a start angle of 45 degrees can be used instead.
$c->setStartAngle(135);
# Set the pie data and the pie labels
$c->setData($data, $labels);
$c->set3D(20);
# output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
?>