mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 17:13:03 +01:00
Qual: Some change to have graph lib able to use img disk generation
libraries like javascript libraries.
This commit is contained in:
@@ -74,30 +74,30 @@ $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
$filenamenb = $dir."/tripsexpensesnbinyear-".$year.".png";
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnbinyear-'.$year.'.png';
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px->SetData($data);
|
||||
$px->SetPrecisionY(0);
|
||||
$px1->SetData($data);
|
||||
$px1->SetPrecisionY(0);
|
||||
$i=$startyear;
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px->SetLegend($legend);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetWidth($WIDTH);
|
||||
$px->SetHeight($HEIGHT);
|
||||
$px->SetYLabel($langs->trans("Number"));
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->mode='depth';
|
||||
$px->SetTitle($langs->trans("NumberByMonth"));
|
||||
$px1->SetLegend($legend);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetWidth($WIDTH);
|
||||
$px1->SetHeight($HEIGHT);
|
||||
$px1->SetYLabel($langs->trans("Number"));
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetPrecisionY(0);
|
||||
$px1->mode='depth';
|
||||
$px1->SetTitle($langs->trans("NumberByMonth"));
|
||||
|
||||
$px->draw($filenamenb);
|
||||
$px1->draw($filenamenb,$fileurlnb);
|
||||
}
|
||||
|
||||
// Build graphic amount of object
|
||||
@@ -108,30 +108,30 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
|
||||
$filenameamount = $dir."/tripsexpensesamountinyear-".$year.".png";
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesamountinyear-'.$year.'.png';
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px->SetData($data);
|
||||
$px2->SetData($data);
|
||||
$i=$startyear;
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px->SetLegend($legend);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetMinValue(min(0,$px->GetFloorMinValue()));
|
||||
$px->SetWidth($WIDTH);
|
||||
$px->SetHeight($HEIGHT);
|
||||
$px->SetYLabel($langs->trans("Amount"));
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->mode='depth';
|
||||
$px->SetTitle($langs->trans("AmountTotal"));
|
||||
$px2->SetLegend($legend);
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue());
|
||||
$px2->SetMinValue(min(0,$px2->GetFloorMinValue()));
|
||||
$px2->SetWidth($WIDTH);
|
||||
$px2->SetHeight($HEIGHT);
|
||||
$px2->SetYLabel($langs->trans("Amount"));
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetPrecisionY(0);
|
||||
$px2->mode='depth';
|
||||
$px2->SetTitle($langs->trans("AmountTotal"));
|
||||
|
||||
$px->draw($filenameamount);
|
||||
$px2->draw($filenameamount,$fileurlamount);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,13 +201,15 @@ print '<td align="center" valign="top">';
|
||||
print '<table class="border" width="100%"><tr valign="top"><td align="center">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else {
|
||||
print '<img src="'.$fileurlnb.'" title="'.$langs->trans("Number").'" alt="'.$langs->trans("Number").'">';
|
||||
print $px1->show();
|
||||
print "<br>\n";
|
||||
print '<img src="'.$fileurlamount.'" title="'.$langs->trans("Amount").'" alt="'.$langs->trans("Amount").'">';
|
||||
print $px2->show();
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@@ -69,19 +69,19 @@ $data = $stats->getNbByMonth($year);
|
||||
$filename = $dir."/tripsexpensesnb-".$year.".png";
|
||||
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnb-'.$year.'.png';
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px->SetData($data);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($filename);
|
||||
$px1->SetData($data);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetMinValue($px1->GetFloorMinValue());
|
||||
$px1->SetWidth($GRAPHWIDTH);
|
||||
$px1->SetHeight($GRAPHHEIGHT);
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetPrecisionY(0);
|
||||
$px1->draw($filename,$fileurl);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,20 +91,20 @@ $data = $stats->getAmountByMonth($year);
|
||||
$filename_amount = $dir."/tripsexpensesamount-".$year.".png";
|
||||
$fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesamount-'.$year.'.png';
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px->SetData($data);
|
||||
$px->SetYLabel($langs->trans("AmountTotal"));
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($filename_amount);
|
||||
$px2->SetData($data);
|
||||
$px2->SetYLabel($langs->trans("AmountTotal"));
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue());
|
||||
$px2->SetMinValue($px2->GetFloorMinValue());
|
||||
$px2->SetWidth($GRAPHWIDTH);
|
||||
$px2->SetHeight($GRAPHHEIGHT);
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetPrecisionY(0);
|
||||
$px2->draw($filename_amount,$fileurl_amount);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,37 +121,37 @@ for ($i = 1 ; $i < 13 ; $i++)
|
||||
$filename_avg = $dir."/tripsexpensesaverage-".$year.".png";
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesaverage-'.$year.'.png';
|
||||
|
||||
$px = new DolGraph();
|
||||
$mesg = $px->isGraphKo();
|
||||
$px3 = new DolGraph();
|
||||
$mesg = $px3->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px->SetData($data);
|
||||
$px->SetYLabel($langs->trans("AmountAverage"));
|
||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue());
|
||||
$px->SetWidth($GRAPHWIDTH);
|
||||
$px->SetHeight($GRAPHHEIGHT);
|
||||
$px->SetShading(3);
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($filename_avg);
|
||||
$px3->SetData($data);
|
||||
$px3->SetYLabel($langs->trans("AmountAverage"));
|
||||
$px3->SetMaxValue($px3->GetCeilMaxValue());
|
||||
$px3->SetMinValue($px3->GetFloorMinValue());
|
||||
$px3->SetWidth($GRAPHWIDTH);
|
||||
$px3->SetHeight($GRAPHHEIGHT);
|
||||
$px3->SetShading(3);
|
||||
$px3->SetHorizTickIncrement(1);
|
||||
$px3->SetPrecisionY(0);
|
||||
$px3->draw($filename_avg,$fileurl_avg);
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td align="center">'.$langs->trans("NumberByMonth").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else { print '<img src="'.$fileurl.'">'; }
|
||||
else { print $px1->show(); }
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else { print '<img src="'.$fileurl_amount.'">'; }
|
||||
else { print $px2->show(); }
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else { print '<img src="'.$fileurl_avg.'">'; }
|
||||
else { print $px3->show(); }
|
||||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
Reference in New Issue
Block a user