include/SugarCharts/SugarChart.php
\SugarChart
Generic chart
- Children
- \JsChart
- Api
Properties
Methods

calculateTotal(
\group $group_by
)
:
intreturns the total amount value for the group by field
| Name | Type | Description |
|---|---|---|
| $group_by | \group | by field |
| Type | Description |
|---|---|
| int | $total total value |

chartArray(
array $chartsArray
)
:
arraywrapper function to return chart array after any additional processing
| Name | Type | Description |
|---|---|---|
| $chartsArray | array | array of chart config items that need processing |
| Type | Description |
|---|---|
| array | $chartArray after it has been process |

checkYAxis(
\value $value
)
:
\yAxisreturns correct yAxis min/max
| Name | Type | Description |
|---|---|---|
| $value | \value | to check |
| Type | Description |
|---|---|
| \yAxis | min and max |

display(
string $name, $xmlFile, $width
=
'320', $height
=
'480', $resize
=
false
)
:
stringwrapper function to return the html code containing the chart in a div
| Name | Type | Description |
|---|---|---|
| $name | string | name of the div string $xmlFile location of the XML file string $style optional additional styles for the div |
| $xmlFile | ||
| $width | ||
| $height | ||
| $resize |
| Type | Description |
|---|---|
| string | returns the html code through smarty |

formatNumber(
$number, $decimals
=
null, $decimal_point
=
null, $thousands_sep
=
null
)
:
void| Name | Type | Description |
|---|---|---|
| $number | ||
| $decimals | ||
| $decimal_point | ||
| $thousands_sep |

generateChartStrings(
string $xmlFile
)
:
\nonegenerates xml file for Flash charts to use for internationalized instances
| Name | Type | Description |
|---|---|---|
| $xmlFile | string | location of the XML file to write to |
| Type | Description |
|---|---|
| \none |

generateXML(
$xmlDataName
=
false
)
:
stringfunction to generate XML and return it
| Name | Type | Description |
|---|---|---|
| $xmlDataName | none |
| Type | Description |
|---|---|
| string | $xmlContents with xml information |

getXMLFileName(
string $file_id
)
:
voidreturns a name for the XML File
| Name | Type | Description |
|---|---|---|
| $file_id | string |
|

nullGroup(
\$sugarSetValue $superSetValue, \$url $url
)
:
voidnullGroup This function sets a null group by clause
| Name | Type | Description |
|---|---|---|
| $superSetValue | \$sugarSetValue | Mixed value |
| $url | \$url | String value of URL for the link |

processDataGroup(
$tablevel, $title, $value, $label, $link
)
:
void| Name | Type | Description |
|---|---|---|
| $tablevel | ||
| $title | ||
| $value | ||
| $label | ||
| $link |

processGauge(
$position, $target, $phases
=
array()
)
:
void| Name | Type | Description |
|---|---|---|
| $position | ||
| $target | ||
| $phases |

saveXMLFile(
string $xmlFilename, $xmlContents
)
:
stringfunction to save XML contents into a file
| Name | Type | Description |
|---|---|---|
| $xmlFilename | string | location of the xml file string $xmlContents contents of the xml file |
| $xmlContents |
| Type | Description |
|---|---|
| string | boolean denoting whether save has failed |

setProperties(
$title, $subtitle, $type, $legend
=
'on', $labels
=
'value', $print
=
'on', $thousands
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $title | ||
| $subtitle | ||
| $type | ||
| $legend | ||
| $labels | ||
| $thousands |

sortData(
array $data_set, $keycolname1
=
null, $translate1
=
false, $keycolname2
=
null, $translate2
=
false, $ifsort2
=
false
)
:
\TheThis function is used for localize all the characters in the Chart. And it can also sort all the dom_values by the sequence defined in the dom, but this may produce a lot of extra empty data in the xml file, when the chart is sorted by two key cols.
If the data quantity is large, it maybe a little slow.
| Name | Type | Description |
|---|---|---|
| $data_set | array | The data get from database string $keycolname1 We will sort by this key first bool $translate1 Whether to trabslate the first column string $keycolname1 We will sort by this key secondly, and it can be null, then it will only sort by the first column. bool $translate1 Whether to trabslate the second column bool $ifsort2 Whether to sort by the second column or just translate the second column. |
| $keycolname1 | ||
| $translate1 | ||
| $keycolname2 | ||
| $translate2 | ||
| $ifsort2 |
| Type | Description |
|---|---|
| \The | sorted and translated data. |

tab(
string $str, $depth
)
:
stringreturns text with tabs appended before it
| Name | Type | Description |
|---|---|---|
| $str | string | input string int $depth number of times to tab |
| $depth |
| Type | Description |
|---|---|
| string | with tabs appended before it |

tabValue(
$tag, $value, $depth
)
:
stringreturns text with tabs appended before it
| Name | Type | Description |
|---|---|---|
| $tag | ||
| $value | ||
| $depth |
| Type | Description |
|---|---|
| string | with tabs appended before it |

xmlFooter(
)
:
stringreturns the footer for the constructed xml file for sugarcharts
| Type | Description |
|---|---|
| string | $footer XML footer |

xmlHeader(
)
:
stringreturns the header for the constructed xml file for sugarcharts
| Type | Description |
|---|---|
| string | $header XML header |

xmlProperties(
)
:
stringreturns the properties tag for the constructed xml file for sugarcharts
| Type | Description |
|---|---|
| string | $properties XML properties tag |