php-RGraph - class rgraph_chart methods reference

methods of class "rgraph_chart" provided by php-RGraph

"rgraph_chart" offers these main purposes for creating charts based on "RGraph":
  1. support data creation and provisioning for RGraph charts
  2. provide setter and getter methods for rgraph_chart objects
  3. deliver data in json format to be used with RGraph
Usage of a rgraph_chart would contain therefore these structure:
  1. 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)
            
  2. use the fetched data form database in the constructor:
     $chart =  new rgraph_chart ("cvs", $data[1], "Bar");
            
  3. create an option (chart properties) object and define chart properies
     $options = new rgraph_options();
     $options->set_option("title", "Most Read Articles");
            ...  more options ...
            
  4. set (define) the chart properties to rgraph_chart object:
     $chart->set_options($options);
            
  5. 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.