Possibilité de forcer la largeur minimum de la zone de légende des tableaux
This commit is contained in:
parent
8fb40f595e
commit
be5125c85f
@ -148,7 +148,7 @@ if ($account > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 1
|
// Fabrication tableau 1
|
||||||
$file= $conf->banque->dir_temp."/solde.$account.$year.$month.png";
|
$file= $conf->banque->dir_temp."/balance.$account.$year.$month.png";
|
||||||
$title=$langs->transnoentities("Balance").' '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
$title=$langs->transnoentities("Balance").' '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
foreach($datas as $i => $val)
|
foreach($datas as $i => $val)
|
||||||
@ -160,6 +160,7 @@ if ($account > 0)
|
|||||||
$px->SetData($graph_datas);
|
$px->SetData($graph_datas);
|
||||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||||
|
$px->SetLegendWidthMin(180);
|
||||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||||
$px->SetTitle($title);
|
$px->SetTitle($title);
|
||||||
@ -246,7 +247,7 @@ if ($account > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 2
|
// Fabrication tableau 2
|
||||||
$file= $conf->banque->dir_temp."/solde.$account.$year.png";
|
$file= $conf->banque->dir_temp."/balance.$account.$year.png";
|
||||||
$title=$langs->transnoentities("Balance").' '.$langs->transnoentities("Year").': '.$year;
|
$title=$langs->transnoentities("Balance").' '.$langs->transnoentities("Year").': '.$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
foreach($datas as $i => $val)
|
foreach($datas as $i => $val)
|
||||||
@ -258,6 +259,7 @@ if ($account > 0)
|
|||||||
$px->SetData($graph_datas);
|
$px->SetData($graph_datas);
|
||||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||||
|
$px->SetLegendWidthMin(180);
|
||||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||||
$px->SetTitle($title);
|
$px->SetTitle($title);
|
||||||
@ -328,7 +330,7 @@ if ($account > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 3
|
// Fabrication tableau 3
|
||||||
$file= $conf->banque->dir_temp."/solde.$account.png";
|
$file= $conf->banque->dir_temp."/balance.$account.png";
|
||||||
$title=$langs->transnoentities("Balance");
|
$title=$langs->transnoentities("Balance");
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
foreach($datas as $i => $val)
|
foreach($datas as $i => $val)
|
||||||
@ -340,6 +342,7 @@ if ($account > 0)
|
|||||||
$px->SetData($graph_datas);
|
$px->SetData($graph_datas);
|
||||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||||
|
$px->SetLegendWidthMin(180);
|
||||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||||
$px->SetTitle($title);
|
$px->SetTitle($title);
|
||||||
@ -408,7 +411,7 @@ if ($account > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fabrication tableau 4
|
// Fabrication tableau 4
|
||||||
$file= $conf->banque->dir_temp."/mouvement.$account.$year.png";
|
$file= $conf->banque->dir_temp."/movement.$account.$year.png";
|
||||||
$title=$langs->transnoentities("Movements").' '.$langs->transnoentities("Year").': '.$year;
|
$title=$langs->transnoentities("Movements").' '.$langs->transnoentities("Year").': '.$year;
|
||||||
$graph_datas=array();
|
$graph_datas=array();
|
||||||
foreach($data_credit as $i => $val)
|
foreach($data_credit as $i => $val)
|
||||||
@ -418,6 +421,7 @@ if ($account > 0)
|
|||||||
$px = new DolGraph();
|
$px = new DolGraph();
|
||||||
$px->SetData($graph_datas);
|
$px->SetData($graph_datas);
|
||||||
$px->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
|
$px->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
|
||||||
|
$px->SetLegendWidthMin(180);
|
||||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||||
$px->SetTitle($title);
|
$px->SetTitle($title);
|
||||||
@ -438,22 +442,22 @@ if ($account > 0)
|
|||||||
print '<table class="notopnoleftnoright" width="100%">';
|
print '<table class="notopnoleftnoright" width="100%">';
|
||||||
|
|
||||||
print '<tr><td align="center">';
|
print '<tr><td align="center">';
|
||||||
$file = "mouvement.$account.$year.png";
|
$file = "movement.$account.$year.png";
|
||||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="center">';
|
print '<tr><td align="center">';
|
||||||
$file = "solde.$account.$year.$month.png";
|
$file = "balance.$account.$year.$month.png";
|
||||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="center">';
|
print '<tr><td align="center">';
|
||||||
$file = "solde.$account.$year.png";
|
$file = "balance.$account.$year.png";
|
||||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="center">';
|
print '<tr><td align="center">';
|
||||||
$file = "solde.$account.png";
|
$file = "balance.$account.png";
|
||||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,8 @@ class DolGraph
|
|||||||
var $PrecisionY=-1;
|
var $PrecisionY=-1;
|
||||||
var $SetHorizTickIncrement=-1;
|
var $SetHorizTickIncrement=-1;
|
||||||
var $SetNumXTicks=-1;
|
var $SetNumXTicks=-1;
|
||||||
|
var $Legend='';
|
||||||
|
var $LegendWidthMin=0;
|
||||||
|
|
||||||
var $graph; // Objet Graph (PHPlot ou Artichow...)
|
var $graph; // Objet Graph (PHPlot ou Artichow...)
|
||||||
var $error;
|
var $error;
|
||||||
@ -286,6 +288,7 @@ class DolGraph
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Génère le fichier graphique sur le disque
|
* \brief Génère le fichier graphique sur le disque
|
||||||
|
* via la librairie PHPlot 5 ou 4
|
||||||
* \param file Nom du fichier image
|
* \param file Nom du fichier image
|
||||||
*/
|
*/
|
||||||
function draw_phplot($file)
|
function draw_phplot($file)
|
||||||
@ -371,6 +374,10 @@ class DolGraph
|
|||||||
$maxlen=max($maxlen,$val);
|
$maxlen=max($maxlen,$val);
|
||||||
}
|
}
|
||||||
$right_space=50+strlen($maxlen)*6; // For legend
|
$right_space=50+strlen($maxlen)*6; // For legend
|
||||||
|
if ($this->LegendWidthMin && $right_space < $this->LegendWidthMin)
|
||||||
|
{
|
||||||
|
$right_space=$this->LegendWidthMin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->graph->SetNewPlotAreaPixels($left_space, $top_space, $this->width - $right_space, $this->height-40);
|
$this->graph->SetNewPlotAreaPixels($left_space, $top_space, $this->width - $right_space, $this->height-40);
|
||||||
@ -503,6 +510,10 @@ class DolGraph
|
|||||||
{
|
{
|
||||||
$this->Legend = $legend;
|
$this->Legend = $legend;
|
||||||
}
|
}
|
||||||
|
function SetLegendWidthMin($legendwidthmin)
|
||||||
|
{
|
||||||
|
$this->LegendWidthMin = $legendwidthmin;
|
||||||
|
}
|
||||||
|
|
||||||
function SetMaxValue($max)
|
function SetMaxValue($max)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user