dolibarr 18.0.6
|
Class to build graphs. More...
Public Member Functions | |
__construct ($library='auto') | |
Constructor. | |
SetHorizTickIncrement ($xi) | |
Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2. | |
SetNumXTicks ($xt) | |
Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2. | |
SetLabelInterval ($x) | |
Set label interval to reduce number of labels. | |
SetHideXGrid ($bool) | |
Hide X grid. | |
setHideXValues ($bool) | |
Hide X Values. | |
SetHideYGrid ($bool) | |
Hide Y grid. | |
SetYLabel ($label) | |
Set y label. | |
SetWidth ($w) | |
Set width. | |
SetTitle ($title) | |
Set title. | |
SetData ($data) | |
Set data. | |
SetDataColor ($datacolor) | |
Set data color. | |
setBorderColor ($bordercolor) | |
Set border color. | |
setBorderWidth ($borderwidth) | |
Set border width. | |
setTooltipsLabels ($tooltipsLabels) | |
Set tooltips labels of the graph. | |
setTooltipsTitles ($tooltipsTitles) | |
Set tooltips titles of the graph. | |
SetType ($type) | |
Set type. | |
SetLegend ($legend) | |
Set legend. | |
SetLegendWidthMin ($legendwidthmin) | |
Set min width. | |
SetMaxValue ($max) | |
Set max value. | |
GetMaxValue () | |
Get max value. | |
SetMinValue ($min) | |
Set min value. | |
GetMinValue () | |
Get min value. | |
SetHeight ($h) | |
Set height. | |
SetShading ($s) | |
Set shading. | |
SetCssPrefix ($s) | |
Set shading. | |
ResetBgColor () | |
Reset bg color. | |
ResetBgColorGrid () | |
Reset bgcolorgrid. | |
setMirrorGraphValues ($mirrorGraphValues) | |
Mirror Values of the graph. | |
isGraphKo () | |
Is graph ko. | |
setShowLegend ($showlegend) | |
Show legend or not. | |
setShowPointValue ($showpointvalue) | |
Show pointvalue or not. | |
setShowPercent ($showpercent) | |
Show percent or not. | |
SetBgColor ($bg_color=array(255, 255, 255)) | |
Define background color of complete image. | |
SetBgColorGrid ($bg_colorgrid=array(255, 255, 255)) | |
Define background color of grid. | |
ResetDataColor () | |
Reset data color. | |
GetMaxValueInData () | |
Get max value among all values of all series. | |
GetMinValueInData () | |
Return min value of all values of all series. | |
GetCeilMaxValue () | |
Return max value of all data. | |
GetFloorMinValue () | |
Return min value of all data. | |
draw ($file, $fileurl='') | |
Build a graph into memory using correct library (may also be wrote on disk, depending on library used) | |
total () | |
Output HTML string to total value. | |
show ($shownographyet=0) | |
Output HTML string to show graph. | |
Static Public Member Functions | |
static | getDefaultGraphSizeForStats ($direction, $defaultsize='') |
getDefaultGraphSizeForStats | |
Public Attributes | |
$data | |
Array of data. | |
Private Member Functions | |
draw_jflot ($file, $fileurl) | |
Build a graph using JFlot library. | |
draw_chart ($file, $fileurl) | |
Build a graph using Chart library. | |
Class to build graphs.
Usage is: $dolgraph=new DolGraph(); $dolgraph->SetTitle($langs->transnoentities('MyTitle').'
'.$langs->transnoentities('MyTitlePercent').''); $dolgraph->SetMaxValue(50); $dolgraph->SetData($data); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); $dolgraph->setHeight('200'); $dolgraph->draw('idofgraph'); print $dolgraph->show($total?0:1);
Definition at line 40 of file dolgraph.class.php.
DolGraph::__construct | ( | $library = 'auto' | ) |
Constructor.
string | $library | 'auto' (default) |
Definition at line 106 of file dolgraph.class.php.
DolGraph::draw | ( | $file, | |
$fileurl = '' ) |
Build a graph into memory using correct library (may also be wrote on disk, depending on library used)
string | $file | Image file name to use to save onto disk (also used as javascript unique id) |
string | $fileurl | Url path to show image if saved onto disk |
Definition at line 728 of file dolgraph.class.php.
References dol_syslog().
|
private |
Build a graph using Chart library.
Input when calling this method should be: $this->data = array(array(0=>'labelxA',1=>yA), array('labelxB',yB)); $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // Syntax deprecated $this->legend= array("Val1",...,"Valn"); // list of n series name $this->type = array('bars',...'lines', 'linesnopoint'); or array('pie') or array('polar') or array('piesemicircle'); $this->mode = 'depth' ??? $this->bgcolorgrid $this->datacolor $this->shownodatagraph
string | $file | Image file name to use to save onto disk (also used as javascript unique id) |
string | $fileurl | Url path to show image if saved onto disk. Never used here. |
Definition at line 1053 of file dolgraph.class.php.
References dol_escape_htmltag(), dol_escape_js(), dol_string_nohtmltag(), dol_string_nospecial(), dol_string_unaccent(), dol_syslog(), and type.
|
private |
Build a graph using JFlot library.
Input when calling this method should be: $this->data = array(array(0=>'labelxA',1=>yA), array('labelxB',yB)); $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // Syntax deprecated $this->legend= array("Val1",...,"Valn"); // list of n series name $this->type = array('bars',...'lines','linesnopoint'); or array('pie') or array('polar') $this->mode = 'depth' ??? $this->bgcolorgrid $this->datacolor $this->shownodatagraph
string | $file | Image file name to use to save onto disk (also used as javascript unique id) |
string | $fileurl | Url path to show image if saved onto disk. Never used here. |
Definition at line 766 of file dolgraph.class.php.
References dol_escape_htmltag(), dol_escape_js(), dol_string_nospecial(), dol_string_unaccent(), dol_syslog(), and type.
DolGraph::GetCeilMaxValue | ( | ) |
Return max value of all data.
Definition at line 671 of file dolgraph.class.php.
References dol_strlen(), and GetMaxValueInData().
|
static |
getDefaultGraphSizeForStats
string | $direction | 'width' or 'height' |
string | $defaultsize | Value we want as default size |
Definition at line 1549 of file dolgraph.class.php.
DolGraph::GetFloorMinValue | ( | ) |
Return min value of all data.
Definition at line 699 of file dolgraph.class.php.
References dol_strlen(), and GetMinValueInData().
DolGraph::GetMaxValue | ( | ) |
DolGraph::GetMaxValueInData | ( | ) |
Get max value among all values of all series.
Definition at line 611 of file dolgraph.class.php.
Referenced by GetCeilMaxValue().
DolGraph::GetMinValue | ( | ) |
DolGraph::GetMinValueInData | ( | ) |
Return min value of all values of all series.
Definition at line 641 of file dolgraph.class.php.
Referenced by GetFloorMinValue().
DolGraph::isGraphKo | ( | ) |
DolGraph::ResetBgColor | ( | ) |
DolGraph::ResetBgColorGrid | ( | ) |
DolGraph::ResetDataColor | ( | ) |
DolGraph::SetBgColor | ( | $bg_color = array(255, 255, 255) | ) |
Define background color of complete image.
array | $bg_color | array(R,G,B) ou 'onglet' ou 'default' |
Definition at line 552 of file dolgraph.class.php.
DolGraph::SetBgColorGrid | ( | $bg_colorgrid = array(255, 255, 255) | ) |
Define background color of grid.
array | $bg_colorgrid | array(R,G,B) ou 'onglet' ou 'default' |
Definition at line 576 of file dolgraph.class.php.
DolGraph::setBorderColor | ( | $bordercolor | ) |
Set border color.
array | $bordercolor | Border Color array(array(R,G,B),array(R,G,B)...) or array('#FFFFFF','#......'...) |
Definition at line 298 of file dolgraph.class.php.
DolGraph::setBorderWidth | ( | $borderwidth | ) |
Set border width.
int | $borderwidth | Border Width |
Definition at line 309 of file dolgraph.class.php.
DolGraph::SetCssPrefix | ( | $s | ) |
Set shading.
string | $s | Shading |
Definition at line 459 of file dolgraph.class.php.
DolGraph::SetData | ( | $data | ) |
Set data.
array | $data | Data |
Definition at line 273 of file dolgraph.class.php.
References $data.
DolGraph::SetDataColor | ( | $datacolor | ) |
Set data color.
array | $datacolor | Data color array(array(R,G,B),array(R,G,B)...) or array('#......','#......'...) |
Definition at line 286 of file dolgraph.class.php.
DolGraph::SetHeight | ( | $h | ) |
DolGraph::SetHideXGrid | ( | $bool | ) |
Hide X grid.
boolean | $bool | XGrid or not |
Definition at line 193 of file dolgraph.class.php.
DolGraph::setHideXValues | ( | $bool | ) |
Hide X Values.
boolean | $bool | XValues or not |
Definition at line 206 of file dolgraph.class.php.
DolGraph::SetHideYGrid | ( | $bool | ) |
Hide Y grid.
boolean | $bool | YGrid or not |
Definition at line 219 of file dolgraph.class.php.
DolGraph::SetHorizTickIncrement | ( | $xi | ) |
Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2.
float | $xi | Xi |
Definition at line 151 of file dolgraph.class.php.
DolGraph::SetLabelInterval | ( | $x | ) |
Set label interval to reduce number of labels.
float | $x | Label interval |
Definition at line 179 of file dolgraph.class.php.
DolGraph::SetLegend | ( | $legend | ) |
Set legend.
array | $legend | Legend. Example: array('seriename1','seriname2',...) |
Definition at line 357 of file dolgraph.class.php.
DolGraph::SetLegendWidthMin | ( | $legendwidthmin | ) |
Set min width.
int | $legendwidthmin | Min width |
Definition at line 370 of file dolgraph.class.php.
DolGraph::SetMaxValue | ( | $max | ) |
Set max value.
int | $max | Max value |
Definition at line 383 of file dolgraph.class.php.
DolGraph::SetMinValue | ( | $min | ) |
Set min value.
int | $min | Min value |
Definition at line 408 of file dolgraph.class.php.
DolGraph::setMirrorGraphValues | ( | $mirrorGraphValues | ) |
Mirror Values of the graph.
boolean | $mirrorGraphValues | Mirror Values if true and doesn't if false |
Definition at line 495 of file dolgraph.class.php.
DolGraph::SetNumXTicks | ( | $xt | ) |
Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2.
float | $xt | Xt |
Definition at line 165 of file dolgraph.class.php.
References SetNumXTicks().
Referenced by SetNumXTicks().
DolGraph::SetShading | ( | $s | ) |
Set shading.
string | $s | Shading |
Definition at line 446 of file dolgraph.class.php.
References SetShading().
Referenced by SetShading().
DolGraph::setShowLegend | ( | $showlegend | ) |
Show legend or not.
int | $showlegend | 1=Show legend (default), 0=Hide legend, 2=Show legend on right |
Definition at line 516 of file dolgraph.class.php.
DolGraph::setShowPercent | ( | $showpercent | ) |
Show percent or not.
int | $showpercent | 1=Show percent for each point, as tooltip or inline, 0=Hide percent (default) |
Definition at line 538 of file dolgraph.class.php.
DolGraph::setShowPointValue | ( | $showpointvalue | ) |
Show pointvalue or not.
int | $showpointvalue | 1=Show value for each point, as tooltip or inline (default), 0=Hide value, 2=Show values for each serie on same point |
Definition at line 527 of file dolgraph.class.php.
DolGraph::SetTitle | ( | $title | ) |
Set title.
string | $title | Title |
Definition at line 259 of file dolgraph.class.php.
DolGraph::setTooltipsLabels | ( | $tooltipsLabels | ) |
Set tooltips labels of the graph.
array | $tooltipsLabels | Tooltips Labels array('...','...'...) |
Definition at line 320 of file dolgraph.class.php.
DolGraph::setTooltipsTitles | ( | $tooltipsTitles | ) |
Set tooltips titles of the graph.
array | $tooltipsTitles | Tooltips Titles array('...','...'...) |
Definition at line 331 of file dolgraph.class.php.
DolGraph::SetType | ( | $type | ) |
Set type.
array | $type | Array with type for each serie. Example: array('type1', 'type2', ...) where type can be: 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', 'horizontalbars'... |
Definition at line 344 of file dolgraph.class.php.
References type.
DolGraph::SetWidth | ( | $w | ) |
Set width.
int | string | $w | Width (Example: 320 or '100') |
Definition at line 246 of file dolgraph.class.php.
DolGraph::SetYLabel | ( | $label | ) |
Set y label.
string | $label | Y label |
Definition at line 233 of file dolgraph.class.php.
DolGraph::show | ( | $shownographyet = 0 | ) |
Output HTML string to show graph.
int | string | $shownographyet | Show graph to say there is not enough data or the message in $shownographyet if it is a string. |
Definition at line 1522 of file dolgraph.class.php.
DolGraph::total | ( | ) |
Output HTML string to total value.
Definition at line 1507 of file dolgraph.class.php.