Test si les valeurs sont "graphables"

This commit is contained in:
Rodolphe Quiedeville 2006-12-11 15:24:13 +00:00
parent 3e48184941
commit 539c531834

View File

@ -724,6 +724,17 @@ class DolGraph
function BarLineOneYearArtichow($file='', $barvalues, $linevalues, $legends='') function BarLineOneYearArtichow($file='', $barvalues, $linevalues, $legends='')
{ {
$ok = 0;
foreach($linevalues as $val)
{
$sum1 += abs($val);
}
foreach($barvalues as $val)
{
$sum2 += abs($val);
}
$ok = sizeof($values) * $sum1 * $sum2;
if (( sizeof($barvalues) * sizeof($linevalues) ) > 0) if (( sizeof($barvalues) * sizeof($linevalues) ) > 0)
{ {
require_once DOL_DOCUMENT_ROOT."/../external-libs/Artichow/BarPlot.class.php"; require_once DOL_DOCUMENT_ROOT."/../external-libs/Artichow/BarPlot.class.php";
@ -807,19 +818,22 @@ class DolGraph
} }
} }
function BarAnnualArtichow($file='', $values='', $legends='') function BarAnnualArtichow($file='', $values='', $legends='')
{ {
require_once DOL_DOCUMENT_ROOT."/../external-libs/Artichow/BarPlot.class.php"; require_once DOL_DOCUMENT_ROOT."/../external-libs/Artichow/BarPlot.class.php";
if (sizeof($values) > 0) $ok = 0;
foreach($values as $val)
{ {
$sum += abs($val);
}
$ok = sizeof($values) * $sum;
if ($ok > 0)
{
$graph = new Graph(500, 200); $graph = new Graph(500, 200);
$graph->title->set($this->title); $graph->title->set($this->title);
$graph->title->setFont(new Tuffy(10)); $graph->title->setFont(new Tuffy(10));
$graph->border->hide(); $graph->border->hide();
$color = new Color(222,231,236); $color = new Color(222,231,236);