Menu

The gChartTool Class

Mark Newnham

Core Public Methods In The gChartTool Class

This list shows the basic methods required to create a Chart/Table

Method Parameter Description
drawPage An all-encompassing function that produces a complete html page, suitable for embedding in an IFRAME
getGoogleJsapi Returns a string with the html necessary for embedding the necessary external javascripts to produce a chart
getVizualizations Gets a list of available packages with their Google types and packages. Only one package can be loaded into a single page. This means, for example, that Bar Chart and a Geo Chart cannot be embedded into a single page at the same time. This is a limitation of Google Charts. To avoid this, charts can be embedded into iframes.
loadGoogleChart Returns a string with the html necessary for creating a Google Chart embedded into your own page.
setAllTableColumns Sets all table Column Descriptors. The data supplied is a PHP array of data, as described above.
setAllTableRows array Sets all table rows. The data supplied can either be a PHP array of data, as described above, or a string containing a Google Dataset.
setChartDivId string Sets the ID of the Div where a google chart will be presented when acquiring the chart data with Ajax
setChartOption array or string pair Sets either a single, or array of options that affect the presentation of the graph or table.
getGoogleLiteralString Returns correctly formatted data from an ajax server program to a client
mergeNextDataSet array Merges a new set of columns onto the data
setSeriesOption array or string pair Sets either a single, or array of options that override the default presentation of series elements. A Series is effectively a Column of Data. See the combo.php example for a more detailed explanation
sethAxisOption array or string pair Sets either a single, or array of options that affect the presentation of the graph horizontal Axis.
setJsonURL string The URL from which the Chart will receive Ajax data
setvAxisOption array or string pair Sets either a single, or array of options that affect the presentation of the graph vertical Axis.
setVizualization string Sets the Type of chart to display, e.g. table, pie, bar, scatter.
setVisualizationDataSource datatable (default) Tells the chart to use a datatable as the source
ajax Tells the chart to use a URL to get the Chart Data
query Tells the chart to use a Google Spreadsheet as a data source

Other Public Methods In The gChartTool Class

This list shows the remaining methods available

Method Parameter Description
createGoogleDataSet array Takes an input array and returns the data as a Google Data Set
getChartOptions Returns an array of all currently set chart options
getDieOnError Gets whether the class will immediately terminate and dump if an error occurs when creating the chart
gethAxisOptions Returns an array of all currently set hAxis options
getSeriesOptions Returns an array of all currently set series options
getTableColumns Returns an array of the currently set table columns
getvAxisOptions Returns an array of all currently set vAxis options
getVizualization Gets the currently set visualization
resetVizualisation This unsets any chart data and options currently set. Effectively, it is the same as re-instantiating the class
setChartHeight integer Sets the chart height. The Parameter is ignored if the Drawpage function is used.
setChartWidth integer Sets the chart width. The Parameter is ignored if the Drawpage function is used.
setIdentifier string This appends the string to each chart element and javascript function. This is only necessary if embedding multiple charts into a single page, to prevent duplication of function names.

See Also [Error Handling]


Related

Wiki: Error Handling

MongoDB Logo MongoDB