Class: jqChart
Source Location: /jqChart.php
Class jqChart
Class Overview
Located in /jqChart.php [line 13]
Author(s):
- Tony Tomov, (tony@trirand.com)
API Tags:
Abstract: | A PHP class to work with jqChart jQuery plugin. |
Information Tags:
Version: | 4.0.0 |
Copyright: | TriRand Ltd |
|
Properties
|
Methods
|
Method Summary
jqChart |
addSeries() |
Add a data to the series with a given name. If the name exists the data will be overwritten. Data can be added via array, sql query or javascript function |
array |
getSQLSerie() |
Return a array representation of the sql query. Also return only the |
string |
renderChart() |
Main method which construct the chart based on the options set with the previous methods |
jqChart |
setColors() |
Set array containing the default colors for the chart's series. |
void |
setJSCode() |
Put a javascript code after all things are created. The method is executed only once when the chart is created. |
jqChart |
setLabels() |
Set HTML labels that can be positioined anywhere in the chart area. |
jqChart |
setLanguage() |
Set a language object. The default language is English. For detailed info on the object rehfer to the documentation |
jqChart |
setLegend() |
Set the legend. The legend is a box containing a symbol and name for each series item or point item in the chart. |
jqChart |
setLoading() |
Set the loading options which control the appearance of the loading screen that covers the plot area on chart operations |
jqChart |
setNavigation() |
Set collection of options for buttons and menus appearing in the exporting module. |
jqChart |
setTooltip() |
Set options for the tooltip that appears when the user hovers over a series or point |
jqChart |
setxAxis() |
Set the X axis or category axis. Normally this is the horizontal axis, though if the chart is inverted this is the vertical axis. |
jqChart |
setyAxis() |
Set the Y axis or value axis. Normally this is the vertical axis, though if the chart is inverted this is the horiontal axis. In case of multiple axes, the yAxis node is an array of configuration objects. |
Methods
jqChart __construct(
[
$db = null]
)
|
|
Parameters:
jqChart addSeries(
string
$name, mixed
$value, [array
$params = null], [mixed
$limit = false], [integer
$offset = 0]
)
|
|
Add a data to the series with a given name. If the name exists the data will be overwritten. Data can be added via array, sql query or javascript function
Parameters:
string |
$name: |
the name of the chart. This will be displayed in the chart |
mixed |
$value: |
can be array, sql query or java script function. |
array |
$params: |
parameters passed to the query in case of SQL data |
mixed |
$limit: |
if set to number the number of records to retrieve |
integer |
$offset: |
how many records to skip in case of sql. |
API Tags:
void convertVar(
$value,
$type
)
|
|
Parameters:
API Tags:
Return all the option for the Chart
API Tags:
array getSQLSerie(
string
$sql, [array
$params = null], [mixed
$limit = false], [number
$offset = 0]
)
|
|
Return a array representation of the sql query. Also return only the
the values of the first column
Parameters:
string |
$sql: |
The sql query string |
array |
$params: |
array of parameters passed to the query |
mixed |
$limit: |
the number of records to retrieve. if false - all |
number |
$offset: |
how many record to skip. 0 - none |
API Tags:
Return: | of the values of the first column of the query |
Access: | protected |
string renderChart(
[string
$div_id = ''], [boolean
$createlem = true], [mixed
$width = '800'], [
$height = '400'], [string
$chart = 'chart']
)
|
|
Main method which construct the chart based on the options set with the previous methods
Parameters:
string |
$div_id: |
the id of the chart element in the DOM. If empty the default name 'jqchart' is used. |
boolean |
$createlem: |
if set to true a div element is created. If the option is set to false the previous option should be set in order to render the chart to a existing element. |
mixed |
$width: |
set the width of the chart. If a number is used the width is created in pixels. Have sense only if $createlem is true |
|
$height: |
set the height of the chart. If a number is used the height is created in pixels. Have sense only if $createlem is true |
string |
$chart: |
the name which is used when a javascript chart object is created. Can be used later to refer to the chart. The default name is 'chart' |
API Tags:
jqChart setChartEvent(
string
$name, string
$jscode
)
|
|
Set event listeners for the chart.
Parameters:
string |
$name: |
The name of the event, Can be click, load, redraw, selection See documentation for more details |
string |
$jscode: |
The javascript code associated with this event |
API Tags:
Return: | instance |
Access: | public |
jqChart setChartOptions(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Options regarding the chart area and plot area as well as general chart options.
Parameters:
mixed |
$name: |
the option name for the chart. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
is the value option in case the name is string |
API Tags:
Return: | instance |
Access: | public |
Set array containing the default colors for the chart's series.
When all colors are used, new colors are pulled from the start again. Defaults to: array('#4572A7', '#AA4643', '#89A54E', '#80699B', '#3D96AE', '#DB843D', '#92A8CD', '#A47D7C', '#B5CA92')
Parameters:
array |
$avalue: |
values to be set for the colors |
API Tags:
Return: | instance |
Access: | public |
jqChart setExporting(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set options for the Exporting module
Parameters:
mixed |
$name: |
the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
void setJSCode(
string
$code
)
|
|
Put a javascript code after all things are created. The method is executed only once when the chart is created.
Parameters:
string |
$code: |
- javascript to be executed |
API Tags:
jqChart setLabels(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set HTML labels that can be positioined anywhere in the chart area.
Parameters:
mixed |
$name: |
the option name for the label. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setLanguage(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set a language object. The default language is English. For detailed info on the object rehfer to the documentation
Parameters:
mixed |
$name: |
the option name for the language. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setLegend(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set the legend. The legend is a box containing a symbol and name for each series item or point item in the chart.
Parameters:
mixed |
$name: |
the option name for the legend. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setLoading(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set the loading options which control the appearance of the loading screen that covers the plot area on chart operations
Parameters:
mixed |
$name: |
the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setNavigation(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set collection of options for buttons and menus appearing in the exporting module.
Parameters:
mixed |
$name: |
the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setPlotOptions(
mixed
$name, [array
$avalue = '']
)
|
|
Set the plot options for the chart.
The plotOptions is a wrapper object for config objects for each series type. The config objects for each series can also be overridden for each series item as given in the series array
Parameters:
mixed |
$name: |
the name of tyhe option as per documentation |
array |
$avalue: |
array of options = key value pair |
API Tags:
jqChart setSeriesOption(
[string
$name = ''], [mixed
$option = ''], [mixed
$value = '']
)
|
|
Set a various options for a serie.
Parameters:
string |
$name: |
the name for the serie |
mixed |
$option: |
can be a array or string. If array a key value pair should be used, where key is the properti value is the optinvalue |
mixed |
$value: |
the value of the option value in case the option is a string |
API Tags:
jqChart setSubtitle(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set the subtitle of the chart
Parameters:
mixed |
$name: |
the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setTheme(
[string
$theme = '']
)
|
|
Set a theme - Can be grid, gray, dark-blue, dark-green
Parameters:
string |
$theme: |
the name of the theme |
API Tags:
jqChart setTitle(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set the main title of the chart
Parameters:
mixed |
$name: |
the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setTooltip(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set options for the tooltip that appears when the user hovers over a series or point
Parameters:
mixed |
$name: |
the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setxAxis(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set the X axis or category axis. Normally this is the horizontal axis, though if the chart is inverted this is the vertical axis.
In case of multiple axes, the xAxis node is an array of configuration objects.
Parameters:
mixed |
$name: |
the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
jqChart setyAxis(
mixed
$name, [mixed
$mixvalue = '']
)
|
|
Set the Y axis or value axis. Normally this is the vertical axis, though if the chart is inverted this is the horiontal axis. In case of multiple axes, the yAxis node is an array of configuration objects.
Parameters:
mixed |
$name: |
the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name |
mixed |
$mixvalue: |
a value option in case the name is a string |
API Tags:
Return: | instance |
Access: | public |
|
|