Optimize size of graph
This commit is contained in:
parent
58bb2df24c
commit
677fb46136
@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||||
|
|
||||||
$WIDTH=500;
|
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||||
$HEIGHT=200;
|
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||||
|
|
||||||
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
|
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
|
||||||
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
|
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
|
||||||
|
|||||||
@ -28,8 +28,8 @@ require '../../../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
|
|
||||||
$WIDTH=500;
|
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||||
$HEIGHT=200;
|
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||||
|
|
||||||
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
|
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
|
||||||
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
|
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
|
||||||
|
|||||||
@ -29,8 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
|
|
||||||
$WIDTH=500;
|
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||||
$HEIGHT=200;
|
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||||
|
|
||||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||||
if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden();
|
if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden();
|
||||||
|
|||||||
@ -29,8 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacementstats.class
|
|||||||
|
|
||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
|
|
||||||
$WIDTH=500;
|
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||||
$HEIGHT=200;
|
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||||
|
|
||||||
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
|
$userid=GETPOST('userid','int'); if ($userid < 0) $userid=0;
|
||||||
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
|
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
|
||||||
|
|||||||
@ -27,8 +27,8 @@ require '../../../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
|
||||||
|
|
||||||
$WIDTH=500;
|
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||||
$HEIGHT=200;
|
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||||
|
|
||||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||||
if ($mode == 'customer' && ! $user->rights->facture->lire) accessforbidden();
|
if ($mode == 'customer' && ! $user->rights->facture->lire) accessforbidden();
|
||||||
|
|||||||
@ -785,7 +785,7 @@ class DolGraph
|
|||||||
|
|
||||||
$this->_stringtoshow ='<!-- Build using '.$this->_library.' -->'."\n";
|
$this->_stringtoshow ='<!-- Build using '.$this->_library.' -->'."\n";
|
||||||
$this->_stringtoshow.='<br><div align="center">'.$this->title.'</div><br>';
|
$this->_stringtoshow.='<br><div align="center">'.$this->title.'</div><br>';
|
||||||
$this->_stringtoshow.='<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;"></div>'."\n";
|
$this->_stringtoshow.='<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph"></div>'."\n";
|
||||||
$this->_stringtoshow.='<script id="'.$tag.'">'."\n";
|
$this->_stringtoshow.='<script id="'.$tag.'">'."\n";
|
||||||
$this->_stringtoshow.='$(function () {'."\n";
|
$this->_stringtoshow.='$(function () {'."\n";
|
||||||
$i=$firstlot;
|
$i=$firstlot;
|
||||||
@ -893,6 +893,21 @@ class DolGraph
|
|||||||
{
|
{
|
||||||
return $this->_stringtoshow;
|
return $this->_stringtoshow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getDefaultGraphSizeForStats
|
||||||
|
*
|
||||||
|
* @param string $direction 'width' or 'height'
|
||||||
|
* @return int Value of width or height to use by default
|
||||||
|
*/
|
||||||
|
static function getDefaultGraphSizeForStats($direction)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
if ($direction == 'width') return ($conf->dol_optimize_smallscreen?'400':'500');
|
||||||
|
if ($direction == 'height') return ($conf->dol_optimize_smallscreen?'160':'200');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -34,8 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$WIDTH=500;
|
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||||
$HEIGHT=200;
|
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user