More test

This commit is contained in:
Laurent Destailleur 2013-09-01 20:55:59 +02:00
parent 0ca6c3f6ad
commit 8cd1563f58

View File

@ -590,12 +590,18 @@ class DolGraph
/** /**
* Build a graph onto disk using correct library * Build a graph onto disk using correct library
* *
* @param string $file Image file name to use if we save onto disk * @param string $file Image file name to use to save onto disk (also used as javascript unique id)
* @param string $fileurl Url path to show image if saved onto disk * @param string $fileurl Url path to show image if saved onto disk
* @return void * @return void
*/ */
function draw($file,$fileurl='') function draw($file,$fileurl='')
{ {
if (empty($file))
{
$this->error="Call to draw method was made with empty value for parameter file.";
dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
return -2;
}
if (! is_array($this->data) || count($this->data) < 1) if (! is_array($this->data) || count($this->data) < 1)
{ {
$this->error="Call to draw method was made but SetData was not called or called with an empty dataset for parameters"; $this->error="Call to draw method was made but SetData was not called or called with an empty dataset for parameters";
@ -797,7 +803,7 @@ class DolGraph
* $this->bgcolorgrid * $this->bgcolorgrid
* $this->datacolor * $this->datacolor
* *
* @param string $file Image file name to use if we save onto disk * @param string $file Image file name to use to save onto disk (also used as javascript unique id)
* @param string $fileurl Url path to show image if saved onto disk * @param string $fileurl Url path to show image if saved onto disk
* @return void * @return void
*/ */
@ -807,6 +813,12 @@ class DolGraph
dol_syslog(get_class($this)."::draw_jflot this->type=".join(',',$this->type)); dol_syslog(get_class($this)."::draw_jflot this->type=".join(',',$this->type));
if (empty($this->width) && empty($this->height))
{
print 'Error width or height not set';
return;
}
$legends=array(); $legends=array();
$nblot=count($this->data[0])-1; // -1 to remove legend $nblot=count($this->data[0])-1; // -1 to remove legend
if ($nblot < 0) dol_print_error('Bad value for property ->data. Must be set by mydolgraph->SetData before callinf mydolgrapgh->draw'); if ($nblot < 0) dol_print_error('Bad value for property ->data. Must be set by mydolgraph->SetData before callinf mydolgrapgh->draw');