methods of class "rgraph_chart" provided by php-RGraph
"rgraph_chart" offers these main purposes for creating charts based on
"RGraph":
- support data creation and provisioning for RGraph charts
- provide setter and getter methods for rgraph_chart objects
- deliver data in json format to be used with RGraph
Usage of a rgraph_chart would contain therefore these structure:
- provide the data for a chart (e.g. from a Joomla database):
$db_config_file = $_SERVER["DOCUMENT_ROOT"] . "/configuration.php";
$sql="Select title, hits From jos_content Order By hits Desc Limit 10";
$data = rgraph_chart::getDataFromDB ($dbconfig, $sql)
- use the fetched data form database in the constructor:
$chart = new rgraph_chart ("cvs", $data[1], "Bar");
- create an option (chart properties) object and define chart properies
$options = new rgraph_options();
$options->set_option("title", "Most Read Articles");
... more options ...
- set (define) the chart properties to rgraph_chart object:
$chart->set_options($options);
- create json object to be used with RGraph:
$rgraph_json = $chart->toString();
To get more information besides references shown here, have a look at my samples or visit the
home of RGraph.